RepRapFirmware (RRF) is the firmware of the Duet controller boards. This page gives
its rules for a line of G-code and its motion commands, from the Duet3D G-code
dictionary as read on 3 December 2026. Probing and levelling codes
(G29 to G32, G38) are not on this page.
Fields
A line is a list of fields separated by white space. A field is a letter followed by a number, or a letter alone as a flag. Letters are not case sensitive from version 1.19 (1.18 and earlier accept capitals only), except inside quoted strings.
| Letter | Usual meaning |
|---|---|
G, M | Command number |
T | Select a tool |
S | Parameter such as seconds or a temperature |
P | Parameter such as milliseconds, or proportional gain in tuning |
X, Y, Z | Coordinates |
U, V, W | Further axes |
A, B, C | Further axes in some commands, other uses in others |
D | Diameter, derivative gain, drive number or a further axis |
I, J | Arc centre offsets; I is also integral gain |
K | Usually the Z probe number |
H | Usually a heater number |
F | Feed rate in mm per minute |
R | Used for temperatures, among other things |
Q | Usually a frequency |
E | Length of filament to feed |
N | Line number (optional) |
* | CRC or checksum (optional) |
From version 3.01 a number may be replaced by an expression in braces, such as
{2+2}. Some parameters take several values separated by colons,
typically one per extruder (E10:10:5); where one value is given and
one per extruder is needed, it applies to all.
Quoted strings
A string parameter may be written in double quotes, so that it can hold spaces and semicolons. A double quote inside it is written twice. For senders that turn everything into capitals, a single quote forces the next character to lower case, and two single quotes stand for one.
M587 S"MYROUTER" P"ABCxyz;"" 123"
M587 S"MYROUTER" P"ABC'X'Y'Z;"" 123"
Both lines give the password ABCxyz;" 123.
Comments, commands and keywords
- A semicolon starts a comment that runs to the end of the line. In CNC mode
(
M453) one pair of parentheses on one line, not nested, is also a comment. - A line may hold several
GandMcommands; from version 3.2 no space is needed before the next one. A command that runs a macro file (G28,G29,G32,M98) must be last on its line, and aTcommand must be alone. - From version 3.01 a line that begins with
abort,break,continue,echo,elif,else,global,if,set,skip,varorwhile(after an optional line number) is a meta command. - Other lines must start with
G,MorT, or be empty apart from a comment. In CNC and laser modes a line of bare fields after aG0toG3line repeats that command with the new fields. - A line of commands may be at most 255 characters, comments not counted.
- From version 2.03 a command that the firmware does not implement runs the
system macro of its name if there is one, so
G40runs/sys/G40.g; from 3.4 this includes numbers with a fraction.
Line numbers, CRC and checksum
N should be the first field. A line without it takes the previous
number plus 1. The firmware does not check that the numbers are consecutive and
asks for no resend; it uses them in error messages and shows them in the object
model field inputs[].lineNumber.
A check value after * ends the line, before any comment, and is only
recognised when the line has a line number. A line whose value does not match, or
that has none on a port where M575 requires one, is discarded with no
reply.
| Form | How it is computed |
|---|---|
| CRC (from 3.4), always 5 decimal digits | CRC-16/CCITT, polynomial x16+x12+x5+1, initial value 0 (CRC-16/XMODEM) |
| Checksum (older), decimal | Exclusive or of every byte of the line, line number included, up to the *, kept to 8 bits |
N100 G0 X100 F6000*51369
File names
0:/ is the root of the on-board SD card (/opt/dsf/sd/
when a single board computer runs the machine), and 1:/ a second
card slot. Long names and spaces are allowed. A full path is limited to 120
characters.
Queueing
G0 to G3 moves go into a move queue and are
acknowledged once queued. From a job file or macro, these commands may also be
queued to take effect after the preceding move, if no parameter is an expression:
M3 and M5 outside laser mode, M4,
M42, M104, M106, M107,
M117, M140, M141, M144,
M150 (when the strip needs no stop), M280,
M300, M568, and G10 without
L or axis letters that has P, R or
S. Most configuration commands, probing, G4,
M400 and T wait for motion to stop.
M555 P6 (nanoDLP compatibility) turns queueing off.
G0 and G1: moves
G0 | G1 with X Y Z E F H S R P; at least
one of X Y Z E F is needed.
| Parameter | Meaning |
|---|---|
X Y Z and further axes | Target position |
E | Filament to feed during the move; with several drives on a tool, Ea:b… drives each directly and overrides the M567 mix ratio |
F | Feed rate per minute |
H | Move type, below |
S | Laser power in laser mode (see below) |
Rn | Move to restore point n (see G60); axis values are offsets from it, and axes not named do not move |
P | Output pin states during the move, in builds that support it (see M670) |
H | Effect |
|---|---|
| 0 | Ordinary move (default): endstops ignored, axis limits applied; an axis not homed may not move unless M564 allows it |
| 1 | Stop when the endstop triggers, ignoring axis limits, and set the position to the M208 limit. On delta, SCARA and polar machines the letters name motors. Normally used with G91 |
| 2 | Move single motors: endstops, limits and homed state ignored. On CoreXY the letters are the A and B motors |
| 3 | Stop at the endstop and set that axis limit to the position, replacing M208 (to measure axis length) |
| 4 | Stop at the endstop and update the current position (3.2 and later) |
The meaning of S has changed between versions:
| Version | Meaning of S and H |
|---|---|
| 2.01 and earlier | No H and no laser mode; S0 to S3 are the move types |
| 2.02 to 2.05.1 | H0 to H3; S is also the move type until laser mode (M452) is set, then laser power |
| 3.0 to 3.4 | H as above; outside laser mode S still means the same as H |
| 3.5 and later | S is only laser power, 0 to 255, a proportion of the maximum set with M452 R; ignored outside laser mode |
An S value fires the laser only on a line that moves. From 3.5.0 up
to 8 values separated by colons split one move into equal parts with their own
power (raster clustering), so G1 X50 S100:50:25:50:100 changes power
every 10 mm.
G0 differs from G1 only here: in laser and CNC modes it
runs at the maximum feed rate of M203 and ignores F, and
on SCARA and similar machines it may be one unsegmented, curved movement.
- Each input channel keeps its own last feed rate, copied from the end of
config.g(3000 mm/min if none was set there) and restored when a macro ends. - From 3.7, an absolute move without
Hto an unreachable position is an error that aborts the job or macro; a relative one is cut to the reachable area unlessM564 R0is set. Up to 3.6, FDM mode limited both silently and the other modes rejected both. - The default minimum speed is 0.5 mm/s; from 2.03
M203 Ichanges it. - An axis position is held in a signed 32-bit microstep count, which limits axis
length (not extruders);
G92resets it. One move may last about 47 minutes on Duet 3 and 38 on Duet 2.
G1 F1500
G1 X90.6 Y13.8 E22.4 ; move and extrude
G1 E10:10:5:0:0 F300 ; tool with five drives
G1 R2 X0 Y0 Z2 ; 2 mm above restore point 2
G2 and G3: arcs
G2 is clockwise, G3 counterclockwise. Supported from
1.18 in FDM mode, 1.20 in CNC mode and 2.01 in laser mode.
| Parameter | Meaning |
|---|---|
X Y Z | End position; give X and Y equal to the start for a full circle |
I J K | Arc centre in X, Y, Z relative to the start (K from 3.3) |
R | Radius instead of a centre (2.03 and later); overrides I J K |
E | Filament, as in G1 |
F | Feed rate; defaults to the current one |
S | Laser power 0 to 255 in laser mode, no clustering |
Either R or at least one of the centre letters is required. From 3.3
they follow the plane: I J in XY, I K in XZ,
J K in YZ. From 3.6.2 an arc given by centre whose start and end radii
differ by more than 0.0022 mm (0.00022 in) in CNC mode, or 0.05 mm
in the other modes, is an error that aborts the job.
G2 X90.6 Y13.8 I5 J10 E22.4
G2 X100 Y50 R200
G4: dwell
P milliseconds or S seconds.
Heaters stay under control during the wait.
G10 and G11: tool settings, offsets and retraction
G10 has three meanings, told apart by its parameters.
| Form | Parameters |
|---|---|
Tool temperatures: P with R or S | P tool, R standby temperature, S active temperature, in °C, one per heater separated by colons. Does not wait (use M116). The tool must exist (M563). The dictionary says this use may be deprecated in favour of M568 |
Offsets: L or P (Duet 2 and later) | L1 (default) tool offset, L2 origin of workplace system P 1 to 9, L20 the same given relative to the current tool position. P defaults to the current tool or system. X Y Z U V W A B C D… offsets |
G10 alone: retract | None. Retracts every extruder of the tool and hops, as set by M207 |
G11 | None. Undoes the hop and unretracts, as set by M207 |
A tool offset is the position of the nozzle relative to the head reference point,
and is subtracted during printing. Offsets are applied after axis mapping, values
not given keep their last setting, and giving only the tool number reports them.
M500 saves workplace offsets and probed tool offsets
(M500 P10 all tool offsets).
G10 P1 R140 S205 ; tool 1 standby 140, active 205
G10 L1 P2 X17.8 Y-19.3 Z0 ; offset of tool 2
G10 L20 P2 X0 Y0 Z0 ; make this point the origin of system 2
G17 to G21: arc plane and units
| Command | Meaning |
|---|---|
G17 | XY plane for arcs (default) |
G18 | XZ plane (3.3 and later) |
G19 | YZ plane (3.3 and later) |
G20 | Inches, for G0 to G3, G10 L2 and L20, G38.2 to G38.5 targets, G92, M206, M585 and M675; keep config.g metric |
G21 | Millimetres (default) |
None takes parameters. Plane and units are kept per input channel, start from the
state at the end of config.g and are restored when a macro ends.
Versions 2.03 to 3.2.2 accept G17 and do nothing.
G28: home
Without parameters every axis is homed. X Y Z U V W A B C D are
flags choosing axes; any numbers with them are ignored. Delta machines always home
all towers. The command may not appear in a homing file.
The chosen axes are marked unknown. If all are to be homed,
homeall.g runs (homedelta.g on a delta); axes still
unknown after it homed only some, and axes chosen singly, are homed by
homex.g, homey.g, homez.g and so on, in
axis order whatever the order of the flags.
G53 to G59.3: coordinate systems
G53 makes the moves on the rest of its line use machine coordinates,
ignoring workplace and tool offsets; it is not modal. G54 to
G59 select workplace systems 1 to 6, and G59.1,
G59.2 and G59.3 systems 7 to 9. System 1 is the default
and all start with zero offset; set offsets with G10 L2. All are for
Duet 2 and later boards.
G53 G1 X50 Y50 Z20
G1 X100 Y100 Z20 ; back in the selected workplace system
G60: save position
G60 Sslot saves the position into a restore point, from 0
(default). Duet boards generally have slots 0 to 5. Pausing saves to slot 1 and a
tool change to slot 2 by itself; from 3.7.1 a feed hold (M25.1) also
saves to slot 1 unless paused. Do not use G60 in
pause.g. Return with G0 or G1
Rslot. Supported from 1.21.
G68 and G69: coordinate rotation
Parameter of G68 | Meaning |
|---|---|
X Y | Centre of rotation |
A B | The same, as first and second coordinate of the selected plane |
R | Angle in degrees, positive counterclockwise seen from above |
I | Flag: add R to the present angle |
Rotation works in the XY plane only, and not for moves with a non-zero
H, under G53 or in system macros. The centre follows a
change of workplace system. From 3.6.1 M500 P68 saves it; from 3.7
G68 without R reports it. G69 cancels
it.
G90 to G94: positioning and feed rate modes
| Command | Meaning |
|---|---|
G90 | Absolute axis positions (default). Extruders are set separately with M82 |
G91 | Relative axis positions; for extruders use M83 |
G92 X Y Z E | Set the current user position without moving, and mark named axes as homed (a linear delta needs all of X Y Z). Without parameters it does nothing. Values outside the reachable area are limited to it (M564 S0 disables the M208 limits). X and Y are refused during G68 rotation |
G93 (3.5 and later) | Inverse time: F means finish in 1/F minutes. Every G1 to G3 line needs F; F on other lines is ignored; G0 in CNC and laser modes is unaffected |
G94 (3.5 and later) | F in units per minute (default) |
These modes are kept per input channel, start from the end of
config.g and are restored when a macro ends; changes made by a job
file last.
Sources
- G-code dictionary – Duet3D’s documentation of RepRapFirmware’s commands, published under a Creative Commons attribution share-alike licence; this page is written in our own words