← Back to CNC Programming

Linear Interpolation: G00 and G01

Two of the most-used G-codes in any program. G00 moves the tool at rapid speed between positions; G01 cuts a straight line at the programmed feed. This page explains the difference, safe approach and retract, diagonal moves, and how to read a block of linear code as a tool path.

The core idea: G00 is for moving in air, fast and unregulated by feed. G01 is for cutting, slow and at a controlled feed. Mixing them up — cutting at rapid, or feeding at rapid speed — is dangerous.

Concept

G00 (rapid positioning) moves the tool to the commanded coordinate at the machine's fastest traverse rate. It does not cut. On most machines all axes move simultaneously at their own maximum speed, so the actual path is not a straight diagonal; it is shaped by whichever axis reaches its target first. The exact rapid path depends on the control and machine geometry, so do not assume a straight L or diagonal.

G01 (linear interpolation) moves the tool in a straight line from the current point to the commanded point at the programmed feed F. The controller computes the straight-line vector and distributes motion across the participating axes so the tip follows a true diagonal at the correct feed. G01 is used for every straight cut: facing, turning OD, pocket walls, chamfers, and plunging.

Two-block G00 vs one-block G01 to (60,40) 4 px/mm. Start (50,200), end (290,40). X Y start (0,0) G01 X60 Y40: straight diagonal at F G00 X60. then Y40. (two-block rapid) (60,40)

Why It Matters

G00 is fast but not a cutting motion. If you use G00 where you meant G01, the tool slams into the part at traverse speed — broken tool, wrecked part, possible spindle damage. If you use G01 for positioning moves, the machine wastes time feeding through air. Reading the tool path correctly — where it is rapid, where it is cutting, and in what order — is the first safety skill of CNC programming.

How It Works

G00: Rapid Positioning

G00 X100. Y50.   (rapid to X100 Y50, no F needed)

G00 is modal: once active, it stays until G01 (or another motion G-code) replaces it. It is used to move the tool between safe positions: from tool change to the start of a cut, between holes, or retracting above the part. Because rapid speed is high, the tool must already be at a safe Z before any XY G00 — never rapid sideways into a vice jaw or a fixture clamp.

G01: Linear Feed

G01 X100. Y50. F300.   (cut a straight line to (100,50) at 300 mm/min)

G01 is also modal. The F word is remembered across subsequent G01 blocks, so you only repeat F when it changes. The straight line can move on one axis (a pure X move) or on several axes at once (a diagonal chamfer). The controller interpolates the feed along the vector length; the nominal feed per tooth is fz = F/(n×z), and actual undeformed chip thickness also depends on cutter engagement.

Safe Approach and Retract

A standard milling approach is: rapid XY to position at safe Z, rapid down to a short clearance above the part (e.g. Z5), then linear plunge to depth at a lower feed, then linear cut at feed. At the end of the cut, rapid Z up to clearance, then rapid XY to the next position. This sequence keeps every sideways move at a Z where the tool cannot hit the part.

StepCodeWhy
XY position at safe ZG00 X.. Y..No side movement at cutting Z
Down to clearanceG00 Z5.Fast but safe above work
PlungeG01 Z-2. F100.Controlled feed into material
CutG01 X50. F300.Feed across the part
RetractG00 Z50.Clear all fixtures before next XY

Reading a Block as a Tool Path

Take this snippet and trace it by hand (units mm/min, G21/G17/G90/G94 in force; H01 and G54 already verified; the tool is a center-cutting end mill):

G21 G17 G90 G94 G40 G49 G80
T01 M06
G54
G00 G43 H01 Z50.
S2000 M03
G00 X0 Y0
G00 Z5.
G01 Z-2. F100.
G01 X40. F300.
G01 Y20.
G01 X0
G00 Z50.

Trace: after the tool change, G43 H01 establishes length comp at verified safe Z50 before any XY move; spindle on; XY to (0,0) at Z50; rapid down to Z5; plunge to Z−2 at F100; cut to X40 at F300; cut to Y20; cut back to X0; rapid retract to Z50. The three G01 blocks after the plunge form three sides of a rectangle wall. No F after the first cut means F300 carries forward.

Single-Axis vs Multi-Axis Linear Moves

A G01 block can move one axis or several. G01 X50. moves only X; G01 X50. Y30. moves diagonally. The controller always treats the commanded point as the target and interpolates a straight line from the current position. On a lathe, G01 X40. Z-20. cuts a taper: if the current diameter is 30, X goes from 30 to 40 (5 mm radial) while Z goes from 0 to −20, producing a straight angled surface. The feed F applies to the vector along that line, not to either axis alone.

Feed on a Diagonal Cut

When X and Y move together, the table feed is the rate along the diagonal. If you program F300 on a 45° move, the tool travels 300 mm along the hypotenuse per minute; each axis moves at 300/√2 ≈ 212 mm/min. The nominal feed per tooth fz = F/(n×z) stays as programmed; actual undeformed chip thickness also depends on cutter engagement and radial immersion, which vary along angled cuts. Do not double the feed on diagonal cuts expecting a faster cycle — the controller already handles the vector.

Chamfers and Corner Breaks

A chamfer is a short 45° linear move between two explicitly defined endpoints. On a lathe, a C1 chamfer on a turned corner goes from (X38, Z0) to (X40, Z−1): diameter changes by 2 mm (1 mm radial) while Z moves 1 mm axial, forming a 45° break. The code is G01 X40. Z-1. F0.2 in G90 diameter programming — both values are absolute endpoints, not increments. On a mill, a C0.5 chamfer on an external corner defined by edges X=10 and Y=10 cuts from (9.5, 10) to (10, 9.5). In both cases the tool path is on the part profile; the actual cut edge depends on the insert nose radius and is best finished with cutter compensation.

Lathe Facing and OD Turning

On a lathe, facing is a linear move in X at constant Z: G01 X0. F0.2 feeds the tool from the outer diameter to the center. OD turning is a linear move in Z at constant X: G01 Z-50. F0.2. Taper turning changes both X and Z in one block. The feed on a lathe is per revolution (G99 on Haas), so F0.2 means 0.2 mm per spindle revolution — the actual table speed depends on RPM.

Rapid Overrides and Safe Z

Most machines have a rapid override switch (100/50/25/F). On the first run of a new program, operators commonly set rapid to 25% or 50% to give more time to react. A slower override is an aid to verification, not a substitute for checking the tool path and clearances in advance — it does not prevent a crash. Once the tool path is proven, run at 100%. This is why programs retract to a verified safe Z before XY: at 100% rapid, a side move into a clamp is over in a fraction of a second.

Example

A facing cut on a rectangular blank: part spans X0…50, Y−5…5 (10 mm wide in Y). Tool 1 is a Ø16 flat end mill (r = 8 mm). Classroom assumptions: tool clears Z50, part top at Z0, depth of cut 0.5 mm, fixture clear above Z50, the tool can plunge at the center (center-cutting):

G21 G17 G90 G94
G54
G00 G43 H01 Z50.
S1800 M03
G00 X-10. Y0
G00 Z0.5
G01 Z-0.5 F100.
G01 X60. F250.
G00 Z50.

The tool centers at Y0. At X−10 the center is 10 mm left of the part edge, which is more than the 8 mm radius, so the full cut enters outside the material. At X60 the center is 10 mm past the right edge. The single pass covers the 10 mm Y width because the 16 mm cutter overlaps ±8 mm around Y0, i.e. Y−8…+8, which covers Y−5…+5. The overhang on both X sides ensures a clean face across the whole length. Without the overhang, the cut starts and stops inside the edge and leaves a step.

Facing cut, Ø16 cutter on 10 mm wide part 4 px/mm. Part X0…50, Y−5…5. Cutter center at Y0. part (X0…50) start X=-10 end X=60 Center clears part edge by 10 mm (> r=8). Cutter covers Y±8 > Y±5.

Feed Hold, Block Skip, and Single Block

When first running a linear program, the operator uses feed hold to pause motion and single block to execute one line at a time. The block skip (/) skips the blocks that carry a slash — only those blocks, not "the first half of the program". Because skipping also skips state-establishing blocks (offsets, spindle on, coolant), it is not a general way to trial-run a program. After each G01 block, confirm the tool is where expected before pressing cycle start again. This is slow on purpose: catching a coordinate error after one block is much cheaper than after a full pocket.

Programming Chamfers with Linear Moves

On a mill, a C0.5 external corner chamfer on edges X=10 and Y=10 cuts the part profile from (9.5, 10) to (10, 9.5). These are part-profile endpoints, not tool-center endpoints; with cutter compensation the tool center is offset by the tool radius. Verify the dimension on the first part, because the insert nose radius changes the actual chamfer geometry.

Canned Cycles Use Linear Moves Inside

Even when you use a drilling or boring canned cycle (G81, G83, G76), the cycle itself is built from linear moves: rapid to R plane, linear feed to depth, dwell, rapid retract. Understanding G00/G01 inside out makes the canned cycle parameters — R plane, Z depth, feed — predictable rather than magic numbers.

Why G01 Is the Default Cutting Mode

Once G01 is modal, every subsequent block cuts linearly until another motion G-code takes over. This is why the startup block includes G90 and the first cutting block sets F: the controller carries both forward. It also means a missing G01 on a later line is not usually an error — the controller stays in linear mode. The danger is assuming it has left G01; if you intended rapid but forgot G00, the tool feeds at F across air.

Linear Cuts on a 5-Axis Machine

On a 3-axis mill, G01 moves X, Y, and Z. On a 5-axis machine, a block can also include rotary axes (A, B, C). The controller interpolates them, but whether the tool tip follows a straight line on the part depends on machine kinematics, tool-center-point control, and feed mode; degrees/minute and mm/min do not combine the way X/Y/Z lengths do. This page stays on 3-axis linear motion; multi-axis feed is covered later.

What Happens if You Forget G01

If the program starts cutting without G01, the controller is still in whatever motion mode was left by the startup block. Many startup blocks set G80 and G40 but do not set G01 explicitly; the first motion block should state G01 with an F. If you omit it and the controller happens to be in G00 from a previous operation, the tool races to the first cut position at rapid speed. Always state the motion mode and feed on the first cutting block.

Linear Motion on a Lathe: Diameter Programming

On a lathe, X values are diameters, not radii. The radial saddle movement for a G01 block is Δr = (Xend − Xstart) / 2. Starting from X30 and commanding X40, the saddle moves radially by 5 mm and the turned diameter grows from 30 to 40. Do not infer travel from the absolute target alone; always subtract the starting X. Mixing diameter and radius thinking in one block is a common beginner error.

Programming Straight Walls

A straight vertical wall on a mill is a G01 in Z at constant XY. A straight horizontal floor is a G01 in XY at constant Z. Pocket walls, step shoulders, and raised pads are all linear cuts. The skill is choosing the right lead-in so the tool approaches the wall without a plunge at the corner, and the right retract so it leaves without a scratch.

Feed Override and First-Piece

On the first run of a linear program, operators often run feed override at 50% or lower. Slower feed gives more time to react if the path looks wrong; it is a verification aid, not a guarantee against a crash. Once the first part is measured and the offsets are confirmed, ramp to 100%. The same caution applies to rapid override: keep rapid slow until you have checked the Z height on every block.

Common Mistakes

Worked Tool-Path Trace

Read this short mill snippet and trace the tool tip:

G54 G90 G00 G43 H01 Z50.
S2000 M03
G00 X0 Y0
G00 Z5.
G01 Z-1. F100.
G01 X40. F250.
G01 Y20.
G01 X0
G00 Z50.

The tip starts at safe Z50 over the origin, plunges to Z−1, then cuts: along the bottom edge Y=0 from X0 to X40, up the right edge X=40 from Y0 to Y20, then back along the top edge Y=20 from X40 to X0. The missing side is the left edge at X=0. This is a three-side wall trace; it is not a complete pocket cut — the tool diameter, stock, and lead-in are not defined here.

Practice

1. What is the difference between G00 and G01?

Show answer

G00 is rapid positioning in air, no feed required. G01 is linear cutting motion at a programmed feed F.

2. You command G01 Z-2. F100., then G01 X50. What feed does X50 use?

Show answer

F100. F is modal and carries forward; no new F is needed unless you want a different feed.

3. Why retract to Z50 before the next XY G00?

Show answer

So the sideways traverse cannot hit the part, vice, or clamps. Sideways rapid at cutting Z is a crash.

4. Is the G00 path from (0,0) to (60,40) a straight diagonal?

Show answer

Not necessarily. Axes move at their own rapid rates; the actual path depends on the control. Program clearance accordingly.

Sources