G01 G-Code: Linear Interpolation Explained with Examples

G01 is the command that tells your CNC machine to move in a straight line while actively cutting material. If G00 gets the tool where it needs to be, G01 is what actually does the machining.

Key Takeaways

  • G01 moves the tool in a straight line at a feed rate you control with the F command
  • It’s modal — once called, it stays active until you switch to G00, G02, or G03
  • You must have a feed rate (F) set before or on the same line as G01, or the machine will alarm out
  • G01 is for cutting. G00 is for positioning. Don’t mix them up.
  • G1 and G01 are identical — the leading zero is optional
G01 – At A Glance
FunctionStraight-line movement at a controlled feed rate
FormatG01 X__ Y__ Z__
TypeModal (Group 1)
Cancelled byG00, G02, G03
RequiresF (feed rate) — must be set

What Does G01 Do?

G01 sets the machine’s movement mode to linear interpolation — a straight-line move from the current position to a target XYZ location.

The CNC axes move so the path is perfectly straight, not a sequence of individual axis movements.

an illustration that shows the X, Y and Z axes on a CNC machine

Speed is controlled by the F command (feed rate). You set a feed rate, call G01, give it a destination, and the machine handles the rest.

G01 is a modal command, which means it stays active until you replace it with another movement command — G00, G02, or G03. You don’t need to repeat G01 on every line.

Format for using a G01 code

The basic format is:

G01 X__ Y__ Z__ F__

You don’t need all three axes every time — include only the ones you’re moving. The F value only needs to appear once and stays in effect until you change it.

G01 X1.0 F20.0     (Move to X1.0 at 20 IPM — Y and Z don't move)
Y2.5               (Move to Y2.5 — still G01, still F20.0)
X3.0 Y4.0 Z-0.25   (Move all three axes simultaneously in a straight line)

G01 vs G1 — Is the Zero Required?

No. G01 and G1 are identical. Most CNC controls accept both.

In practice, experienced programmers often use the shorter G1 to save keystrokes. If your shop has a programming standard, follow it. If it’s your own code, use whichever format you prefer.

G01 vs G00

Both commands move the tool in a straight line. The difference is speed and intent.

G01 moves at your programmed feed rate. Use it when the tool is cutting material — the speed controls your chip load, surface finish, and tool life.

G00 moves at the machine’s maximum speed and ignores the feed rate entirely. Use it for positioning only — getting the tool to the right spot before you start cutting.

Real Program Example

O0101                           (Program number)
G90 G54                         (Absolute mode, work offset 1)
G00 X0.0 Y0.0                   (Rapid to start position)
G43 H01 Z0.5 M03 S1200          (Tool length comp, spindle on at 1200 RPM)
G01 Z-0.125 F10.0               (Feed to depth at 10 IPM — now cutting)
X4.0                            (Cut along X axis)
Y3.0                            (Cut along Y axis)
X0.0                            (Return along X)
Y0.0                            (Return along Y — square perimeter complete)
G00 Z1.0                        (Rapid clear)
M05                             (Spindle off)
M30                             (Program end)

G01 is called once and stays modal through the entire cutting section. The feed rate is set on that first line and carries through every cut that follows.

What to Watch Out For

Units — Inches vs Millimeters

Make sure your program has the right units code set. G20 is inches, G21 is millimeters. Moving 10 millimeters instead of 10 inches is a crash waiting to happen.

Absolute vs Incremental Mode

G01 works in whatever positioning mode is currently active. G90 (absolute) means all coordinates reference your work zero. G91 (incremental) means coordinates are relative to where you are right now. Know which one you’re in before writing moves.

The images below show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.

graph paper example of absolute positioning with multiple points as examples
graph paper example of incremental positioning with multiple points as examples

Know Your Path

G01 moves in a perfectly straight line from point A to point B. Before calling it, think about the path — not just the destination.

Clamps, vises, and fixture bolts live between start and end points. A move that looks correct on paper can still crash if something’s in the way.

COMMON MISTAKE – Forgetting Your Feed Rate

Calling G01 without a feed rate set on the same line or earlier in the program. On most controls this triggers an alarm. Always verify F is set before your first G01 cut.

How to Cancel G01

G01 doesn’t have a dedicated cancel command — you switch to another Group 1 movement code:

Using any of these codes will turn G01 off and switch to the new movement mode.

FAQS

What’s the difference between G00 and G01?

G00 moves at the machine’s maximum rapid speed and ignores the feed rate — use it for positioning only.

G01 moves at the feed rate you specify with the F command — use it whenever the tool is cutting material.

Does G01 need a feed rate on every line?

No. G01 is modal and so is the F command — both stay active once set. You only need to specify a new feed rate when you want to change cutting speed.

Can G01 move multiple axes at the same time?

Yes. If you include X, Y, and Z values on the same G01 line, the machine coordinates all three axes to move in a straight diagonal path to the target position.

Is G1 the same as G01?

Yes, they’re identical. The leading zero is optional and most modern CNC controls accept both formats.

Leave a Comment