G00 moves the machine at full rapid speed to get the tool into position; G01 moves it in a straight line at the feed rate you set with F, and is the code that actually cuts. Use G00 only in clear air, and use G01 whenever the tool is touching, or about to touch, the material. Both are modal, so whichever one you used last stays active until you call another motion code.
Every toolpath, however complicated, is built from these straight moves and the arcs covered in the G02 & G03 guide. Understanding exactly how the machine behaves on each one is the first step to programs that run safely the first time.
1. What Are They?
These two codes switch the machine between its non-cutting "travel" mode and its controlled "cutting" mode.
G00 (G0)
Rapid positioning. The axes move at the machine's rapid rate. Used only for moving through air to get into position or to retract away from the part.
G01 (G1)
Linear interpolation. The machine moves in a straight line at a controlled feed rate. Used whenever the tool is in the material, and for the last approach into it.
G00, G01, G02 and G03 all belong to the same group of motion codes (group 01 on Fanuc-style controls). Only one can be active at a time, and calling one cancels the others.
2. G00: The Need for Speed (and Caution)
G00 ignores the programmed feed rate. Each axis moves at its own maximum rapid rate, set by the machine builder. On typical vertical machining centres that is several hundred to over 1,000 inches per minute (roughly 10–35 m/min or more), and faster still on high-speed machines.
G00 X2.0 Y2.0
(Drop the tool rapidly to 0.1 inches above the part)
G00 Z0.1
The rapid override on the control panel (usually 100%, 50%, 25% and a slow setting) scales all G00 moves. Prove out new programs at 25% rapid with your hand near feed hold.
The "Dogleg" Rapid Danger
On many machines, a G00 move with two or more axes does not follow a straight line. Each axis drives at its own rapid rate, so the axis with the shorter distance arrives first and the tool finishes the move along the other axis alone. The path looks like a bent leg, a "dogleg". Whether your machine does this depends on the control and a machine parameter, so never assume a rapid is straight. A dogleg that cuts the corner of a vice jaw, clamp or fixture is a common cause of crashes.
Safe rapid habits
- Approach: rapid in X and Y at a safe Z height first, then rapid down in Z to a clearance plane just above the part.
- Retract: rapid up in Z first, then move in X and Y.
- Clearance plane: 0.1 in (2–3 mm) above the highest surface is normal for the last rapid, more over rough castings or saw-cut stock.
- Lathes: on a lathe, retract in X away from the part before moving in Z back toward the turret's home, so the tool does not drag across the work or into the chuck.
3. G01: Linear Interpolation and the F Word
With G01 the control moves the tool from where it is to the programmed point in a perfectly straight line, coordinating all the axes involved. How fast it moves is set by the F word.
F is modal too: once set, it stays in force for later G01, G02 and G03 moves until you change it. If no feed has been set when the first G01 is read, most controls stop with an alarm instead of moving.
G00 Z0.1
(Feed down into the material at 15 inches per minute)
G01 Z-0.5 F15.0
(Cut a straight line to X5.0 at 30 inches per minute)
G01 X5.0 F30.0
What F means: per minute or per revolution
- Feed per minute (G94 on mills): F is inches or millimetres per minute. This is the usual mode on machining centres.
- Feed per revolution (G95 on mills, G99 on Fanuc-style lathes): F is inches or millimetres per spindle turn. This is the usual mode on lathes.
- Units follow G20 (inch) or G21 (metric). F30. means 30 IPM in G20 but 30 mm/min in G21, which is very slow.
F on a multi-axis move
F is the speed along the path, not the speed of each axis. From X0 Y0, the line G01 X3. Y4. F50. is 5 inches long (a 3-4-5 triangle). At 50 IPM it takes 5 ÷ 50 = 0.1 minute, or 6 seconds. During that move X travels at 30 IPM and Y at 40 IPM, and the control keeps them in step so the tool follows the straight line.
Work out the feed itself from the chip load and RPM, as described in the speeds and feeds guide, or use the Speeds & Feeds Calculator.
Modal Commands
G00 and G01 are modal. Once one is active, it stays active until you call another motion code. You don't need to write G01 on every line of a series of cutting moves, but you must be sure which mode is active when the next line of coordinates runs.
4. A Complete Example Program
This short Fanuc/Haas-style mill program cuts a 1/2 in wide, 0.25 in deep slot straight across a 4 in long part, with the part's left edge at X0 and the slot centreline at Y0.5.
O1001 (SLOT EXAMPLE)
G20 G17 G40 G49 G80 G90 G94 (inch, XY plane, cancel comp and cycles, absolute, feed per minute)
T1 M06 (1/2 END MILL)
G00 G54 X-0.6 Y0.5 S3000 M03 (rapid to start, clear of the part)
G43 H01 Z1.0 M08 (length offset, safe height, coolant on)
Z0.1 (still G00: rapid to clearance plane)
G01 Z-0.25 F10. (feed down beside the part)
X4.6 F30. (still G01: cut the slot and exit the far side)
G00 Z1.0 (retract Z first)
M09
M05
G91 G28 Z0. (return Z to machine home)
G90
M30
%
Points to notice:
- The tool feeds down at X-0.6, where it is clear of the part by 0.35 in (0.6 minus the 0.25 in tool radius), so the end mill never plunges into solid material. To enter solid material, ramp or helix in instead; the Helical Ramp Calculator works out the moves.
Z0.1andX4.6have no G code of their own. They use whatever motion mode was active, G00 and G01 respectively.- The first lines set the modes explicitly. Never rely on modes left over from the last program. The G90 & G91 guide, work coordinates guide and tool length offsets guide explain G90, G54 and G43.
5. Rapids and Cycle Time
Rapid moves cost little time on their own. A 20 in move at 1,000 IPM takes 20 ÷ 1,000 = 0.02 minute, about 1.2 seconds, plus a little for acceleration. Feeding the same 20 in at 30 IPM takes 40 seconds. Long air moves programmed as G01, often left by CAM "feed between passes" settings, are a common source of slow cycle times. On the other hand, rapids that come too close to the work to save fractions of a second add risk for little gain.
6. Proving Out G00 Rapid Moves
To prove out the rapids in a new program, run it with the rapid override at 25% or lower, single block on and a hand on feed hold, and check the distance to go before each rapid towards the part. On most controls the feed override does not slow G00 moves, so the rapid override is the one that matters.
- Check it off the machine first. Run the program through a simulator or the G-Code Viewer. Rapids are drawn in red, so one that passes through a clamp or the part stands out.
- Run it in the air. Shift the Z work offset up by a safe amount (for example 1 in or 25 mm) so every move happens above the part. Put the offset back, and check it, before the real run. Some controls also have a dry run mode; check what it does on yours, because on some machines it changes the rapid speed as well as the feed.
- Turn the rapid override down. Use 25% or the lowest setting for the first run.
- Use single block. Each press of cycle start runs one line, so you can stop before a rapid you are not sure about.
- Watch the distance to go. Before the last rapid down to the clearance plane, stop and compare the distance to go on the screen with the real gap between the tool and the part. If the screen shows more travel than there is room for, stop: the work offset, the tool length offset or the program is wrong.
- Keep a hand on feed hold. Feed hold stops G00 and G01 moves alike.
- Only go back to 100% rapid once every rapid has been seen. After a tool change, an offset change or an edit, prove out the changed part again.
7. Common Mistakes
- Forgetting to switch back to G01. After a G00 approach, a line of coordinates with no G code is also a rapid. If it was meant to cut, the tool rapids into the part.
- Rapiding too close. Rapiding straight to Z0. or below the top of rough stock instead of a clearance plane.
- Missing decimal points. Many Fanuc-style controls read a number with no decimal point in the smallest unit, so
X5can mean 0.0005 in (or 0.005 mm), not 5. Always writeX5.orX5.0. - The wrong F units. A feed per revolution value run in feed per minute mode (or the other way round) gives a wildly wrong speed.
- Assuming a straight rapid. Check multi-axis G00 moves for a dogleg around clamps and vice jaws.
- Proving out at full rapid. Use single block, 25% rapid and a reduced feed override for the first run (see proving out G00 rapid moves).
Visualise Your G-Code
Paste the example program into the G-Code Viewer to see the toolpath drawn on screen. Rapids are drawn in red and feed moves in blue, and it estimates the cycle time, so a rapid that passes through the part stands out.
Open G-Code ViewerFor a list of every common G and M code with a one-line description, see the G & M Code Reference.
Frequently Asked Questions
Conclusion
Use G00 to move quickly through clear air, and G01 with a properly calculated feed for every move in or near the material. Remember that both codes and the F word are modal, that a multi-axis rapid may not be straight, and that a missing decimal point can change a move completely. Check new programs in a viewer and prove them out slowly at the machine.