What a code actually does, in plain English — for reading a file someone else wrote as much as writing your own.
36 of 36 commands
Move as fast as the machine allows, in a straight line, without extruding or cutting. Used for repositioning.
Move in a straight line at a controlled feed rate — the workhorse command. On a 3D printer it usually extrudes; on a CNC it's the cutting move.
Move along a curved arc, clockwise, to a given endpoint and centre offset.
Same as G2, but the arc curves the other way.
Pause in place for a set time (e.g. G4 P500 pauses 500ms) without moving.
All following coordinates and feed rates are read as inches.
All following coordinates and feed rates are read as millimetres — the default on almost every hobby machine.
Move the given axes (or all axes if none specified) to their endstops to establish a known zero position.
Probe the bed at multiple points and build a mesh to compensate for an unlevel or warped surface. 3D printing only.
Every coordinate that follows is measured from the origin (0,0,0), not from the current position.
Every coordinate that follows is measured from wherever the machine currently is.
Tell the firmware the current location IS a given coordinate, without moving there. Common use: G92 E0 to zero the extruder count.
Pause and wait for the user to resume — used for manual filament changes or inspection points.
Turn on the spindle (clockwise) or laser. On laser firmware, often paired with an S value for power.
Spindle on, counter-clockwise. On some laser firmwares, laser on with power that scales with move speed.
Turn off the spindle or laser.
Energise the stepper motors so they hold position and can move.
De-energise the stepper motors — same as M84. The axes can be moved by hand afterward.
Same as M18.
Extruder position (E) is measured as a running total from zero, not per-move.
Extruder position (E) is measured per move, from wherever it currently is.
Start heating the nozzle to a target temperature and continue immediately — doesn't wait.
Same as M104, but the machine waits until the temperature is reached before continuing.
Start heating the bed to a target temperature without waiting.
Same as M140, but waits until the bed reaches temperature.
Set the part cooling fan speed (M106 S255 is full speed, S0 is off).
Turn the part cooling fan off. Equivalent to M106 S0.
Ask the firmware to report the current X/Y/Z/E coordinates.
Ask the firmware to report its name, version and capabilities.
Show a short text message on the machine's LCD screen, if it has one.
Set the maximum speed allowed per axis.
Set how quickly the machine can speed up or slow down.
Scale all print speeds by a percentage without re-slicing (M220 S150 runs 50% faster).
Scale the extrusion amount by a percentage — the live version of the extrusion multiplier.
Pause the command queue until every queued movement has actually completed.
Pause and run the firmware's filament-change routine — park, unload, wait, reload.