Linear interpolation – G0 and G1

G0 and G1 explained: rapid traverse and linear interpolation with feed rate F – the fundamental motion commands in CNC programming, with a code example.

G0 and G1 are two fundamental G-codes in CNC programming that control the movement of the machine tool. They are like the basic directions that tell a driver where to go and how fast.

G0 – rapid traverse

The G0 command, known as rapid traverse, is like a sprinter covering the distance between two points as fast as possible. With G0, the machine moves at maximum speed. The command is used to bring the tool to a new position without cutting any material.

G1 – linear interpolation

The G1 command is the actual linear interpolation command: a controlled walk in which every step is precisely planned. G1 moves along a straight line between two points while cutting or engraving material. The speed is set via the feed rate (F). The feed rate determines how fast the tool moves along the path – and thereby affects the surface quality, the tool load and the machining time.

Example

G0 X50 Y20 Z2      ; rapid traverse to the start position above the part
G1 Z-3 F100        ; plunge to depth at a feed rate of 100 mm/min
G1 X120 Y20 F300   ; mill a straight path at a feed rate of 300 mm/min

Together, G0 and G1 form the backbone of CNC motion commands: G0 for fast positioning, G1 for controlled machining.