This page gives the G-code that Smoothieware accepts, as written on the
edge branch of its repository, read on 3 December 2026. This
is the first-generation firmware. SmoothieV2 is a separate code base whose
source was not read for this page. Smoothieware has no central command
table: each module tests for the numbers it handles, so a board answers
only the commands of the modules its build and configuration file
enable.
How a line is read
- An empty line is answered
ok, as is a line starting with;or(. A comment later in a line starts at the first of either character. - A line starting with
$or a lower-case letter is not G-code and goes to the command shell. - G-code lines start with
G,M,T,SorN. Letters are matched in upper case anywhere in the command. A number after a point following the G or M number is a subcode, as inG92.4. - A line starting with
X,Y,ZorF, or with a space, is prefixed with the last modalG0toG3(a loneFwithG1). Other upper-case starts are answeredok - Ignored. - With
N, the line number and the checksum after*are checked. The checksum is the exclusive OR of the characters before*, kept to eight bits. A bad checksum or a number that does not follow the previous one is answeredrs Nnwith the number wanted.M110on a numbered line sets the current number. Lines withoutNare not checked. - A line may hold several commands; it is split at each following
GorM.
Replies, errors and halting
- Commands are acknowledged with
ok;G1is acknowledged as soon as it is received. In grbl mode, or with the one-reply-per-line setting, oneokis sent per line. - When a handler reports an error,
Error:(grbl mode:error:) and its text are sent and the board enters the halted state. - While halted, only
M2,M5,M9,M30,M80,M81,M105,M106,M107,M114,M115,M119,M503andM911run.M999clears the halt, with a warning to home again. Other commands are answered!!(grbl mode:error:Alarm lock).
Motion and coordinates
| Command | Meaning and parameters |
|---|---|
G0, G1 | Rapid and feed moves: X Y Z, E, further axes A B C, F in units per minute (kept separately for G0 and the others). S is modal and used as spindle or laser power. |
G2, G3 | Clockwise and anticlockwise arcs; the centre is given as offsets I J K. |
G4 | Dwell: P milliseconds (grbl mode: seconds), S seconds. |
G10 L2, G10 L20 | P work coordinate system (0 is the current one), X Y Z. L2 sets the offset (adds to it in relative mode); L20 sets it so that the present position reads as given. |
G10 L1 | Tool offset: P tool (1 is T0), X Y Z. |
G10, G11 | Without L, G10 is firmware retraction and G11 recovery; a repeated one is ignored. |
G17, G18, G19 | Arc plane XY, XZ, YZ. |
G20, G21 | Inches, millimetres. |
G43.1, G43.2, G49 | Set the tool offset X Y Z; add to it and move at once; clear it. |
G53 | The G0 or G1 that follows on the line is in machine coordinates. |
G54 to G59, G59.1 to G59.3 | Select one of nine work coordinate systems. |
G90, G91 | Absolute or relative positions, extruder included. |
M82, M83 | Absolute or relative extrusion. |
G92 | Set offsets so that the present position reads as the X Y Z given; E sets the extruder position, A B C theirs. G92.1, G92.2 or no parameters reset; G92.3 sets the offsets directly (used in saved settings); G92.4 sets the machine position, as manual homing. |
G98, G99 | Start a drilling cycle, retracting after each hole to the starting height or to the R plane. |
G81, G82, G83 | Drill a hole at X Y: Z depth, R retract plane, F feed, Q peck step, P dwell (unit set by configuration). Values persist from hole to hole. Absolute mode only. |
G80 | End the drilling cycle. |
M2 | End of program: first coordinate system, absolute mode, speed factor reset, modal motion G1, spindle and coolant off. M30 does the same in grbl mode. |
M17 | Enable the motors. |
M18, M84 | Motors off. M18 with X Y Z A B C E disables only those. |
M92 | Steps per millimetre: X Y Z A B C E; P selects an extruder. |
M114 | Report position. Plain: work coordinates (C:). .1 real-time work, .2 real-time machine, .3 actuator, .4 last target, .5 last compensated machine position. |
M120, M121 | Save and restore the motion state. |
M203 | Maximum speeds in mm/s: X Y Z Cartesian, S overall; for an extruder E, and V maximum volumetric rate in mm³/s. M203.1 sets actuator maxima X Y Z A B C. No parameters reports. |
M204 | Acceleration: S default, X Y Z A B C per axis (0 or less removes the axis value), E extruder. |
M205 | X junction deviation, Z junction deviation for Z (−1 or less disables), S minimum planner speed. |
M211 | S1 turns soft endstops on, another value off. |
M220 | Speed factor S percent, limited to 10 to 1000. |
M400 | Wait for queued moves to finish. |
M425 | Backlash compensation, in builds that include it: P enable, axis letters in millimetres. Not saved. |
Tn | Select tool n, counted from 0, after queued moves finish. The T may stand on its own or on another command’s line. |
Homing, endstops and delta settings
| Command | Meaning and parameters |
|---|---|
G28 | Home all axes, or those named. On machines that home all towers together, any of X Y Z homes the three. In grbl mode it moves to the parking position instead. |
G28.1 | Store the present X and Y as the parking position. |
G28.2 | Go to the parking position (grbl mode: home). |
G28.3 | Manual homing: set the named axes X Y Z A B C to the values given; without any, all are homed at 0. |
G28.4 | The same by actuator position, X Y Z. |
G28.5, G28.6 | Clear the homed flags (named axes or all); report them. |
M119 | Report endstop and probe states. |
M206 | Homing offset per axis, used from the next homing. On a rotary delta, X Y Z are angle offsets in degrees. |
M306 | Set the homing offset from the present position X Y Z; the axis must be homed and becomes unhomed. On a rotary delta it calibrates the homing angles from the true angles given; L1 takes the last probe travel into account. |
M665 | Arm geometry. Z maximum height (delta and SCARA); other letters depend on the kinematics, for a linear delta L rod length and R radius. S segments per second, or without it U millimetres per line segment (these two are not saved). |
M666 | Endstop trim X Y Z (delta and SCARA); negative is downward. |
Probing and levelling
| Command | Meaning and parameters |
|---|---|
G30 | Probe downward once and print Z:. F feed, R non-zero reverses. With Z, sets the current height to that value (not on a rotary delta). The head returns unless Z or G30.1 is used. |
G38.2 to G38.5 | Straight probe by the distances X Y Z (at least one non-zero) at F. .4 and .5 invert the probe sense. The result is [PRB:x,y,z:1], or ending 0 if nothing triggered; .2 and .4 then raise an alarm and halt. |
M48 | Repeatability test: P number of probes (10), F feed. |
M670 | Probe settings: S slow, K fast and R return feed rates, Z maximum travel, H probe height, I invert (not kept), D dwell. |
G29, G31, G32 | Passed to the configured levelling strategy, as below. P chooses among several (0 is the first). |
M565 | Probe offsets X Y Z. |
M370, M561 | Clear and disable the bed compensation. |
M374, M374.1 | Save the probed grid; delete the saved one. |
M375, M375.1 | Load the saved grid; show the grid. |
| Strategy | Its G29, G31, G32 and other codes |
|---|---|
| Three point | G29 test the points; G31 report the plane and probe state; G32 probe and define the plane. M557 P 0 to 2 X Y sets a point. M561 with A B C D restores a saved plane. |
| Rectangular grid | G31 or G32 probe the grid: X Y size, I J points per side. R1 starts at the present position without homing, offset by X Y, with size A B. G29 scans for flatness: X Y size, I J points, at least 5 each. |
| Delta grid | G31 probe the grid. G29 flatness test, G29.1 along a spiral: I number (7, or 50 for the spiral), J radius. |
| Delta calibration | G32 calibrate endstop trim and radius; R skips the endstop step, E the radius step; I target precision, J probe radius, K keep the present trim. G29 probes seven points, G29.1 prints them in another form. |
Temperature and extrusion
Each temperature controller takes its report, set and wait numbers from
the configuration. The defaults are M105,
M104 and M109; a bed is customarily given
M140 and M190.
| Command | Meaning and parameters |
|---|---|
M105 | Report, per controller: letter, current temperature, / target, @ output. |
M104, M109 and the configured equivalents | S target, 0 off. With a tool manager, only the active tool’s heater responds. The wait form blocks until the temperature is reached and halts if the reading is unreliable. |
M143 | S controller index, P maximum temperature. |
M301 | PID: S controller index, P I D, X integral maximum, Y output maximum. |
M303 | PID autotune: E controller index (required), S target (150), C cycles (at least and by default 8), B noise band (0.5), L look-back seconds (10). M304 aborts. |
M305 | S controller index with the sensor’s own letters sets them; S alone ends the override. |
M200 | D filament diameter for volumetric extrusion; 0.01 or less turns it off. |
M207 | Retraction: S length, F feed in mm/min, Z lift, Q lift feed. |
M208 | Recovery: S extra length, F feed in mm/min. |
M221 | Flow factor S percent. On a laser machine see below. |
M404 | Filament detector: S seconds per check, P pulses per millimetre, H leave the heaters on. M405 disables it, M406 enables it, M407 reports. |
The extruder codes apply to the selected extruder; M92,
M200, M203, M204,
M207 and M208 also take P to name
one. A temperature switch module may be given its own arming code, where
S non-zero arms it.
Spindle, laser, switches and drivers
| Command | Meaning and parameters |
|---|---|
M3, M5 | Spindle on, with optional S speed; off. |
M957 | Report the spindle speed. |
M958 | Spindle controller terms P I D. |
M221 (laser) | S power percent, P non-zero disables automatic power, R PWM frequency in hertz; no parameters reports. |
| Switch codes | Fans, lights, servos and the like are switch modules whose on and off codes (G or M, with an optional subcode) are named in the configuration, for example M106 and M107 for a fan. On a sigma-delta output S is the level on a 0 to 255 scale; on PWM outputs it is a duty cycle in percent; without S the configured value is used. A digital output just turns on. |
M907 | Digital potentiometer current for channels X Y Z A B C D. An E selects the old lettering and draws a deprecation warning. |
M906 | Smart driver current in milliamps, by the motor’s axis letter, limited to its configured maximum. |
M909, M909.1 | Microstepping by axis letter; .1 also rescales the steps per millimetre. |
M911 | Dump driver state. .1 one driver (P number or axis letter; R machine-readable form), .2 write register R with value V, .3 set chopper and stall options, whose letters depend on S and the driver chip. |
SD card, host and settings
| Command | Meaning and parameters |
|---|---|
M20, M21 | List the card; mount it again. |
M23, M32 | Select the named file; select and start it. |
M24, M25 | Start or resume printing the selected file; pause. |
M26 | Stop and reload the file from the start. |
M27 | Report progress. |
M28, M29 | M28 with a name stores the following lines of that stream in a file on the card, until M29. |
M30 | Delete the named file (grbl mode: end of program). |
M600, M600.1 | Suspend the print; .1 leaves the heaters on. |
M601 | Resume. G28 cancels a suspension. |
M112 | Emergency stop: halt until a reset or M999. |
M115 | Firmware name, address, version, protocol version, build date, clock, number of axes, grbl mode and capability fields. |
M117 | Show the rest of the line on the panel. |
M500 | Write the current settings to the config-override file on the card. |
M501, M504 | Load; save. Each takes an optional name, giving config-override.name. |
M502 | Delete the override file; takes effect after a reset. |
M503 | Print the settings. |
M999 | Clear a halt. |
M1000 | Pass the rest of the line, in lower case, to the command shell. |
SCARA calibration
On Morgan SCARA machines M114 adds the arm angles theta and
psi. Each of the following moves to a pair of test angles; where
P is accepted, giving it records the corrected present
position instead.
| Command | Theta and psi | With P |
|---|---|---|
M360 | 0°, 120° | sets the theta trim |
M361, M361.1 | 90°, 130°; 180°, 225° | rescales the steps per degree from theta |
M362 | 0°, 90°, after clearing the psi trim | not used |
M363 | 180°, 270° | rescales the psi steps per degree |
M364 | 45°, 135° | sets the psi trim |
M366 | Converts the trims into endstop offsets. | |
Dollar commands and real-time characters
| Input | Meaning |
|---|---|
$G, $I | Report the modal state ($I without ok). |
$# | Report the coordinate offsets. |
$X | Unlock after a halt. |
$H | Clear any halt and home. |
$S | Switch command. |
$J | Jog: distances for X Y Z A B C, with S a fraction of maximum speed or F a feed in mm/min. -c continuous, -r send ok when done, for use inside a file. |
? | Status report between < and >: a state (Alarm, Home, Hold, Idle or Run) followed by fields such as MPos, WPos and F, separated by |. |
| Control-X | Halt. |
| Control-Y | Request that the current operation stop. |
!, ~ | Feed hold and resume on the USB port, when feed hold is enabled. |
Not covered
SmoothieV2 and its additions, such as the G28.7 and
G33 that the documentation marks as version 2 only, are not
described. The documentation also lists G94,
M408, M951 and M952, for which no
handler was found in the version 1 modules searched. Codes defined by a
particular configuration file, the configuration settings and their
defaults, the lower-case shell commands and most reply texts are not
given here.
Sources
- Smoothieware, edge branch – the modules under
communication,robot,toolsandutils, GNU General Public Licence version 3 or later; this page is written in our own words - Supported G-codes – the project’s documentation page