G00 and G01: Rapid and Linear Moves
G00 and G01 are the two most common lines in any CNC program. G00 moves the tool quickly when it's clear of the material; G01 cuts in a straight line at the feed rate.
G00 and G01 move the tool in a straight line from where it is to the position in the X, Y and Z words. The difference is speed and purpose:
- G00 (rapid) moves at the machine's maximum speed. It's for getting the tool into position when it's clear of the material: up to a safe height, over to the start of a cut, back down to just above the part.
- G01 (linear feed) moves at the feed rate in the
Fword. It's for cutting.
Both are modal: once a G00 or G01 is active, it stays active until another motion code (G00, G01, G02 or G03) replaces it. A line with only coordinates repeats the last one.
G00 vs G01
| G00 | G01 | |
|---|---|---|
| Speed | Machine's rapid rate | Feed rate from F |
| Path | Straight line on GRBL and LinuxCNC; can be a dog-leg on some Fanuc-style controls | Always a straight line |
| Use it for | Positioning in clear air | Cutting |
| Feed rate needed | No | Yes, before the first G01 |
On some Fanuc-style controls, each axis in a G00 move travels at its own maximum rate, so a diagonal rapid can finish one axis before the other and take a bent path. Don't count on a rapid move going in a straight line past a clamp.
A safe rapid pattern
Most crashes happen on rapid moves, because the tool is moving at full speed. A safe habit:
- Rapid Z up first, to a height that clears clamps and the part.
- Rapid in X and Y to the start of the next cut.
- Rapid Z down to a clearance height a few millimetres above the material.
- Feed into the material with G01.
Never rapid sideways below the top of the stock, and never rapid down into material that hasn't been cut yet.
Example: cut a rectangle
The tool rapids to Z10, over to X0 Y0 and down to Z2. It then feeds down to Z-1 at 200 mm/min, cuts the rectangle at 600 mm/min, and rapids back up.
(G00 and G01 example: cut a 40 x 30 mm rectangle 1 mm deep)
G21 G17 G90 G54
T1 M6 (6 mm flat end mill)
S12000 M3
(G00: rapid to a safe height, then over the start corner)
G0 Z10
G0 X0 Y0
G0 Z2
(G01: feed down into the material, then around the rectangle)
G1 Z-1 F200
G1 X40 F600
Y30
X0
Y0
(G00: rapid back up to clear the part)
G0 Z10
M5
M30
Open it in CutViewer to compare the rapid moves with the cutting moves, and see the cutting and rapid distances in the Job panel.
Line by line:
G0 Z10andG0 X0 Y0move up first, then across, following the safe pattern above.G1 Z-1 F200plunges at a slower feed rate than the side cuts.G1 X40 F600sets a new feed rate for the profile.Fis modal too, so the next three lines use 600 mm/min.Y30,X0andY0have no G-code. G01 is still active, so they're cutting moves.
How CutViewer shows G00 and G01
CutViewer draws rapid and cutting moves separately and totals the cutting and rapid distance in the Job panel. The run-time estimate uses your feed rates for cutting moves and assumes 5,000 mm/min for rapids. The pre-flight checks flag a G01 with no feed rate, cutting with the spindle off, a rapid sideways move below Z0, and a rapid plunge below Z0 into uncut material.
Frequently Asked Questions
What is the difference between G00 and G01?
G00 is a rapid move at the machine's maximum speed, used to position the tool when it's clear of the material. G01 is a straight cutting move at the feed rate set by F. Use G00 to get to a cut and G01 to make it.
Are G0 and G00 the same?
Yes. The leading zero is optional, so G0 and G00, or G1 and G01, mean the same thing on every common control.
Does G00 use the F feed rate?
No. G00 always moves at the machine's rapid rate, which you can only slow down with the rapid override on the control. F applies to G01, G02 and G03.
Do I need to repeat G01 on every line?
No. G00 and G01 are modal, so they stay active until another motion code replaces them. A line with only X, Y or Z words repeats the last motion code.
What happens if a G01 has no feed rate?
Most controls stop with an alarm, for example GRBL's "undefined feed rate" error, because they don't know how fast to move. Set F on the first G01 or earlier in the program.
More G-Code Guides
Clockwise and counter-clockwise arcs with I/J/K or R.
Pause for a set time, in seconds or milliseconds.
Choose the XY, XZ or YZ plane for arcs.
Inch or millimetre units for the program.
Return to home or a second reference position.
Cutter radius compensation, left, right and off.
Tool length offset on and off.
Work coordinate systems and machine coordinates.
Drilling canned cycles, from plain drilling to peck drilling.
Tapping cycle, and how to work out the feed rate.
Absolute positions or incremental distances.
Set the current position by shifting coordinates.
Feed per minute, per revolution, or inverse time.
Constant surface speed or a fixed spindle RPM.
Where a drilling cycle retracts between holes.
Spindle, coolant, tool change, stop and subprogram codes.
Check your own program before you cut: open it in CutViewer to see the toolpath in 3D, the run time and any problems.
Open CutViewer