GRBL GCODE Instructions

The following article describes the most important GRBL Gcode instruction. Please directly visit the GRBL wiki for further information

Please make sure that externally generated GCODE is GRBL compatible. Non compatible GCODE instructions can lead to mistakes during execution of your GCODE. Most errors are automatically detected – however we would recommend using our Postprocessors, GRBL compatible GCODE or DIN ISO GCODE.

Reduce comments if possible. We automatically remove comments which are placed within your GCODE. A GRBL supported comment should be placed between brackets and should look like:

(This is a comment)

List of the most important GCODEs

The following list comprises the most important GCODEs of GRBL version 1.1. We have omitted the coordinate systems of GRBL. There is a possibility to permanently set the coordinate systems in your GRBL control unit. However we do not recommend these settings as they are not reset upon restart. We recommend using our work coordinate system, macros, pre and post Gcode extensions as they are completely reset upon restart. Please read the information on the coordinate systems in the GRBL wiki if you want to change them.

G0

Rapid move – rapid linear movement

G0 moves the machine with maximum velocity, in linear motion to the specified coordinates

zB.: G0 X50 Y50 Z0 – moves the machine from the actual position to the specified position X50 Y50 Z0 with maximum speed in a linear motion

G1

Linear move with specified feed rate

G1 moves the machine with the feed velocity, in linear motion to the specified coordinates. The speed is defined via the letter F – feed rate in mm/min

e.g.: G1 X100 Y100 Z0 F100 – moves the machine from the actual position in a linear motion to X100 Y100 Z0 with a feed rate of 100mm/min

G2, G3

Controlled Arc Move

G2/G3 moves the machine in an arc motion. Arc motions are usually automatically generetad by your CAM program. Please note GRBL only supports 2D arc motion. 3D helical arcs have to be converted to G1 motion codes by your CAM program.

zB.: G2 X8Y5 I8 J5 F100

G38.2, G38.3

Tool Length Measurement

G38.2 Z-65 F100 starts a tool length measurement. The machine moves into the specified direction until it detects a tool length signal (G38.3 suppresses the error code if the measurement fails)

eg.: G38.2 Z-65 F100 – tool length measurement in Z dirextion. The machine moves to Z-65 until the tool length signal is triggered. The machine stops upon triggering.

G38.4, G38.5

Tool Length Measurement

G38.4 starts an inverted tool length measurement. The machine moves until the tool length signal stops (G38.5 suppresses the error code upon not detecting a signal change)

e.g.: G38.4 Z-65 F100 – – tool length measurement in Z dirextion. The machine moves to Z-65 until the tool length signal is no longer triggered. The machine stops upon a loss of the signal (inverted logic to G38.2)

G53

Movement in machine coordinates

G53 moves the milling machine in machine coordinates instead of work coordinates. The command must be present in each line (otherwise GRBL automatically moves in work coordinates) – works only with G0 and G1

zB.: G53 G0 X50 Y50 Z0 – moves the milling machine in a rapid linear move to X50 Y50 Z0

G90, G91

Absolute / Incremental

G90 moves the milling machine in absolute coordinates, G91 moves the milling machine in relative coordinates.

G90 G0 X50 – the milling machine moves to the position X50 in work coordinates
G91 G0 X50 – milling machine moves from the current position +50mm in X.

G92, G92.1

Definition of the work coordinates

G92 defines the work coordinates. G92 X0 Y0 Z0 sets all coordinates at the current position to 0. G92.1 resets the work coordinates to machine coordinates

e.g.: G92 X0 Y0 Z0 – sets the work coordinates at the current position to X0 Y0 Z0

M3, M5

Milling spindle

M3 switches the spindle on, M5 switches the spindle off. M3 requires the spindle speed

e.g.: M3 S12000 – spindle is switched on with a spindle speed of 12000 rpm
M5 – is switched of

M8, M9

Coolant switch

M8 / M9 controls the coolant output. M8 switches the coolant on, M9 switches the coolant off.

M8 – coolant on
M9 – coolant off

List of all supported GCODEs

Modal Group Member Words
Motion Mode G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80
Coordinate System Select G54, G55, G56, G57, G58, G59
Plane Select G17, G18, G19
Distance Mode G90, G91
Arc IJK Distance Mode G91.1
Feed Rate Mode G93, G94
Units Mode G20, G21
Cutter Radius Compensation G40
Tool Length Offset G43.1, G49
Program Mode M0, M1, M2, M30
Spindle State M3, M4, M5
Coolant State M7, M8, M9