Back to Supported G-Codes

G0 & G1 - Linear Movement Commands

DMC File Mode: Supported
Streaming Mode: Supported

Description

G0 and G1 are the fundamental linear movement commands in G-code. Both commands move the tool in a straight line from the current position to the specified target position. The key difference between them is the speed at which the movement is executed:

  • G0 (Rapid Linear Move): Uses the machine's rapid speed setting for fast positioning moves
  • G1 (Linear Move): Uses the specified feedrate for controlled cutting or drawing operations

These commands form the foundation of most CNC operations, enabling precise positioning and controlled material removal or deposition.

Syntax

G0 X[position] Y[position] Z[position] F[feedrate]
G1 X[position] Y[position] Z[position] F[feedrate]

Parameters

ParameterDescriptionExample
XTarget X-axis positionX10.5
YTarget Y-axis positionY25.0
ZTarget Z-axis positionZ5.0
FFeedrate (units per minute)F1000

Note: All parameters are optional. If a coordinate is not specified, the machine will maintain its current position on that axis.

Feedrate Behavior

G0 Feedrate Handling

When an F parameter is specified with G0, it sets the feedrate for future G0 commands. This allows you to control the speed of rapid moves when the default rapid speed is too fast for your application.

G1 Feedrate Handling

When an F parameter is specified with G1, it sets the feedrate for future G1 commands. This feedrate remains active until explicitly changed by another F parameter.

Independent Feedrates

G0 and G1 commands maintain separate feedrate settings. Setting the feedrate for G0 does not affect G1 feedrate, and vice versa.

Examples

Basic Positioning

; Move rapidly to position (10, 20, 5)
G0 X10 Y20 Z5
; Move at controlled feedrate to (15, 25, 5)
G1 X15 Y25 F500

Setting Different Feedrates

; Set G0 rapid feedrate to 2000 units/min
G0 F2000 X0 Y0
; Set G1 feedrate to 300 units/min
G1 F300 X10 Y10
; G0 still uses 2000, G1 still uses 300
G0 X20 Y20
G1 X30 Y30

Single Axis Movement

; Move only Z-axis rapidly
G0 Z10
; Move only X-axis at controlled speed
G1 X50 F800

Typical CNC Sequence

; Rapid move to starting position (tool up)
G0 X0 Y0 Z10
; Rapid move down to just above work
G0 Z1
; Controlled move to cutting depth
G1 Z-2 F100
; Cut at working feedrate
G1 X10 Y10 F500
; Rapid retract
G0 Z10