← All Knowledge topics
LightBurn learning topic

G-code

Understand laser G-code motion, units, coordinate modes, power commands, feed rates and safe preflight checks.

8published guides
G-codeFREE

G-code Preflight Before You Trust a File

A preflight should establish units, distance mode, motion/laser state, bounds, feed/power context, unsupported commands and machine-specific assumptions before execution.

#G-code
GuideAdvanced
G-codeFREE

F and S: Feed Rate and Laser/Spindle Command Scale

F sets feed context for controlled moves; S sets spindle/laser command value within the controller scale. S is not automatically a percentage unless mapped against the configured maximum.

#G-code
GuideBeginner
G-codeFREE

M3/M4/M5: Laser Output State in GRBL G-code

M3/M4 enable output modes and M5 disables output. For GRBL lasers, M4 is associated with dynamic laser power when supported/configured.

#G-code
GuideIntermediate
G-codeFREE

G90/G91: Absolute vs Incremental Distance Mode

G90 interprets axis values as absolute positions; G91 interprets them as increments from the current position. The same line can move somewhere entirely different under the other mode.

#G-code
GuideBeginner
G-codeFREE

G20/G21: Inches vs Millimeters

G20 and G21 establish control units for following coordinates/feed values. A unit mismatch can turn a safe-looking file into a massively oversized move.

#G-code
GuideBeginner
G-codeFREE

G2/G3 Arcs: I/J Centers, R Radius and Plane

G2/G3 describe clockwise/counter-clockwise arcs. Arc interpretation depends on active plane and whether center offsets (I/J) or radius (R) are used.

#G-code
GuideIntermediate
G-codeFREE

G0 and G1: Rapid vs Linear Feed Motion

G0 is rapid/travel motion; G1 is controlled linear feed motion. On laser jobs the important question is also whether laser output is active during the move.

#G-code
GuideBeginner
G-codeFREE

G-code Modal State: Why One Line Depends on Earlier Lines

Many G-code words remain active until replaced: units, distance mode, motion mode, feed and spindle/laser state. Reading an isolated line without modal context can be misleading.

#G-code
GuideIntermediate