This page gives the G-code that Repetier-Firmware accepts, as written in
version 1.0.4 on the master branch of its repository, read on
3 December 2026. The repository is archived. Most commands are compiled in
only when the printer’s configuration enables the feature, so a given
printer answers a subset of what is listed. The separate 2.0 line on the
dev2 branch is summarised at the end.
How a line is read
- A line ends at a line feed, a carriage return or a zero byte. A
;starts a comment that runs to the end of the line. A(or%ends the reading of the line. - The parameter letters are
N G M X Y Z E F T S P I J R D C H A B K L O, in either case.SandPare read as integers,Tas an 8-bit integer; the others that carry a measurement are decimal numbers. M20,M23,M28,M29,M30,M32,M36,M117,M118andM531take the rest of the line as text. The text stops at*, and for all of them exceptM20,M117andM531also at the first space.*nis a checksum: the exclusive or of every character before the asterisk. A wrong value rejects the line. A build can demand checksums once one has been seen.Nnis a line number, compared as a 16-bit value with the previous number plus one; a gap brings a resend request.M110with a line number resets the count and answersok.- A line holds at most one command, taken in the order
G, thenM, thenT.Tnalone waits for the queued moves and selects extruder n. M112stops the printer as soon as the line is accepted. A build with the emergency parser also acts onM108,M112,M290andM416on arrival, ahead of the queue.- An unknown code is reported only when error messages are switched on in
the debug level. After a fatal error no
GorTcommand runs, and of theMcodes onlyM110andM999.
The binary command form
Besides text, the firmware reads a binary form of a command, which hosts use to send less data. Numbers are little-endian. A packet starts with a 16-bit field of flags telling which values follow; bit 7 is always set, which is how a binary packet is told from a text line. If bit 12 is set (version 2), a second 16-bit flag field follows, and then, if text is present, one byte with the text length. The values then follow in the order of this table, and the packet ends with two check bytes.
| Order | Value | Flag | Type |
|---|---|---|---|
| 1 | N | first, bit 0 | unsigned 16-bit |
| 2 | M | first, bit 1 | 1 byte; 2 bytes in version 2 |
| 3 | G | first, bit 2 | 1 byte; 2 bytes in version 2 |
| 4 to 7 | X, Y, Z, E | first, bits 3 to 6 | 32-bit float each |
| 8 | F | first, bit 8 | 32-bit float |
| 9 | T | first, bit 9 | 1 byte |
| 10, 11 | S, P | first, bits 10 and 11 | 32-bit signed integer each |
| 12 to 22 | I J R D C H A B K L O | second, bits 0 to 10 in this order | 32-bit float each |
| 23 | text | first, bit 15 | 16 bytes, or in version 2 the stated length |
| last | check bytes | 2 bytes |
The check bytes are the two sums of a Fletcher-16 over all bytes before them, each kept modulo 255: first the running sum of the bytes, then the running sum of that sum. After binary commands have been received, a text line sent over the connection without a checksum is refused, unless it is one of the commands that take text.
Motion and positions
| Command | Meaning and parameters |
|---|---|
G0, G1 | Straight move: X Y Z E F. An S, if given, switches off the check of the destination when nonzero. In laser mode G0 moves with the laser off |
G2, G3 | (Arc support) Clockwise, counter-clockwise arc: centre by offsets I J, or radius R |
G4 | Wait after the queued moves: P milliseconds or S seconds; S wins |
G10, G11 | Retract, undo the retraction, by the stored settings; with several extruders S above 0 selects the long retraction |
G20, G21 | Inches, millimetres |
G28 | Home X Y Z; with no axis and no E, all three. E sets the extruder position to 0 |
G90, G91 | Absolute, relative positions |
G92 | Set the current position: X Y Z change the origin offsets, which are then reported; E sets the extruder position |
M82, M83 | Absolute, relative extrusion |
M114 | Report the position; S nonzero adds the positions in steps |
M400 | Wait for the queued moves |
M401, M402 | Store the position; return to it, on the axes named by X Y Z E, at F |
M606 | (Dual X carriages) Park the active carriage X from its side, at F |
Probing, levelling and calibration
| Command | Meaning and parameters |
|---|---|
G29 | Probe three points and report the average height; S nonzero applies it to the Z origin or printer height, S2 also saves to EEPROM |
G30 | One probing. S measures the probe height, taking the nozzle to be at height Z (the current Z if absent). Otherwise P (default 3; bit 0 first probing of a series, bit 1 last), and with H or R the Z position is set for a probed object of height H with Z offset R |
G31 | Report the state of the probe |
G32 | Bed levelling; S is passed to the levelling routine |
G33 | (Distortion correction) Measure the bed; L list the table, R reset it, X Y Z set the correction at the nearest point |
G100 | (Delta) Calibrate within the lowest tenth of the height: X Y Z set the floor of a tower (at most 10 mm), R adds to the rod radius (at most 10 mm), R0 computes it with the head touching the bed at X 0, Y 0 |
G131 | (Delta) Remove the tool offset |
G132 | (Delta) Measure the endstop offsets; S above 0 stores them. Switches levelling off |
G133 | (Delta) Measure the steps to the top endstops |
G134 | (Probe, several extruders) Measure nozzle height differences: P reference extruder, S only this one, Z added correction |
G135 | (Delta) Report the tower positions in steps |
M119 | Report the endstops |
M251 | (Z max endstop) Take the current Z as bed level, set the printer height and save |
M320, M321 | Switch automatic levelling on, off; S nonzero saves, M321 S3 also resets the matrix |
M322 | Reset the levelling matrix; S saves |
M323 | Distortion correction: S above 0 on, 0 off, P1 permanently; without S report |
M890 | Report the bed bending correction at X Y |
Temperature and fans
| Command | Meaning and parameters |
|---|---|
M104 | Set an extruder temperature: S degrees, or H for its preheat temperature; T extruder, O offset added, F above 0 beep. With P or S0 the queued moves finish first |
M109 | The same, waiting for the temperature |
M140 | Set the bed temperature: S or H, O, F |
M190 | The same, waiting |
M105 | Report temperatures; X adds raw readings |
M116 | Wait for all heaters |
M155 | Automatic temperature reports: on without S or with S nonzero, S0 off |
M170 | Preheat temperatures: B bed, T with S an extruder, L list; changes are saved. A C for a chamber is named in the source comment but not read |
M106 | Fan on: S speed (default 255), P1 second fan; I nonzero makes further fan commands be ignored, I0 ends that |
M107 | Fan off; P1 second fan |
M460 | Temperature range of the thermostatic fan: X lowest, Y highest |
M203 | With S other than 255, switch temperature monitoring on; S255 or no S switches it off. X Y Z E on the same code set the maximum feed rates per minute |
M204 | PID gains: S controller (an extruder number; a higher number is the bed), X P, Y I, Z D |
M302 | Allow cold extrusion; S0 forbids it |
M303 | PID autotune: S temperature (150), P controller (0), R cycles (5), C method (0), X store the result |
Motion settings and EEPROM
| Command | Meaning and parameters |
|---|---|
M92 | Steps per millimetre: X Y Z E |
M200 | Volumetric extrusion: D (or R) filament diameter, 0 or none switches it off; T extruder |
M201, M202 | Greatest acceleration while printing, while travelling: X Y Z E in mm/s² |
M207 | Jerk: X for X and Y, Z, E start speed of the extruder. Note that this is not the retraction setting other firmware gives this number |
M209 | Automatic retraction: S nonzero on |
M218 | Tool offsets in millimetres: T, X Y Z; S above 0 saves |
M220, M221 | Speed, flow factor in percent: S (100) |
M205 | List the EEPROM settings |
M206 | Write one EEPROM value: P position, T type (0 byte, 1 16-bit, 2 32-bit integer, 3 float), value in S for types 0 to 2 and in X for type 3 |
M500, M501, M502 | Save to EEPROM, load from it, restore the values of the configuration |
M670 | Set the EEPROM version byte to S |
M163, M164 | (Mixing extruder) Set weight P of drive S; store the weights as virtual extruder S, P nonzero in EEPROM |
M223, M232, M233 | (Pressure advance) Add S test steps; report the measured advance figures; set linear Y and, in builds with the quadratic term, X |
M280 | (Ditto printing) S sets the mode; 0 off |
M450 | Report the mode |
M451, M452, M453 | Printer, laser, CNC mode |
SD card and job control
| Command | Meaning and parameters |
|---|---|
M20 | List the card; in builds with JSON output M20 S2 P/folder lists a folder as JSON |
M21, M22 | Mount, unmount the card |
M23 file | Select a file |
M24, M25 | Start or resume, pause the print from the card |
M26, M27 | Set the file position to byte S; report the status |
M28 file, M29 | Start, stop writing the following lines to a file |
M30 file | Delete a file |
M32 directory | Make a directory |
M36 file | (JSON output) Report information about a file as JSON |
M73 | While printing from the card, show progress P and remaining time R |
M530 | Host print state: S1 printing, 0 or absent not; L number of layers |
M531 name | Name of the file being printed, up to 20 characters |
M532 | Progress X in percent, current layer L |
M539 | S declares support for start and stop from the printer; P shows or leaves the pause menu |
M415 | (Host rescue) S on or off, Z declares the Z position; reports the rescue state |
M416 | Handle a power loss reported by the host |
M600 | (With a display and retraction) Filament change |
M601 | S above 0 pauses the extruder heaters, B nonzero the bed too; otherwise resume, waiting if P is given and is not 1 |
M602, M603, M604, M513 | (Jam control) S debugging, P disable; report a jam; set limits (T, X slow-down steps, Y error steps, Z slow-down value); mark all extruders unjammed |
Motors, hardware and messages
| Command | Meaning and parameters |
|---|---|
M3, M4, M5 | Laser or spindle on with power or speed S (M4 counter-clockwise, CNC mode only), off |
M17, M18 | Enable, disable the motors named by X Y Z E, or all |
M84 | S sets the idle time in seconds after which motors go off; without it, motors off now |
M85 | Inactivity shutdown after S seconds; none means 0 |
M99 | Switch the motors X Y Z off for S seconds (10), then on again |
M80, M81 | Power supply on, off |
M42 | Pin P: with S (0 to 255) a digital output, high when nonzero; without, an input with pull-up whose level is reported. Protected pins are refused |
M226 | Wait until pin P reads S; X0 plain input, X1 with pull-up |
M340 | Servo P (0 to 3): pulse S in microseconds, R time after which it is switched off, in ms |
M290 | Babystep Z by Z millimetres |
M300 | Beep: S frequency (500), P milliseconds (1000) |
M120 | Beeper test: S and P |
M355 | Case light S; without it report |
M350 | Microstepping: S all drivers, or X Y Z E P R one each |
M907, M908, M909, M910 | Motor current: percent by S (all) or X Y Z E; value S of channel P; read the digital potentiometer; store it |
M122, M914, M915 | (TMC2130) Diagnostics; stall threshold; StealthChop, per driver by X Y Z E A B; with none of X Y Z the current values are reported first |
G201 to G205 | (Extra motor drivers, P number) go to X; take the position as X; report; enable or disable by S; home (S nonzero return afterwards, E nonzero only if never homed) |
M108 | Break off a long waiting command |
M111 | Debug level: S sets it; P sets the given bits, a negative P clears them. Bits: 1 echo, 2 information, 4 errors, 8 dry run (heaters are switched off), 16 communication only, 32 no moves, 64 endstops |
M115 | Firmware report, with capability lines PROGRESS, AUTOREPORT_TEMP, HOST_RESCUE, EEPROM, AUTOLEVEL, Z_PROBE, SOFTWARE_POWER, TOGGLE_LIGHTS, PAUSESTOP, PREHEAT and EMERGENCY_PARSER |
M117 text | Show a message on the display |
M118 text | Send the text back to the host |
M360 | Report the configuration |
M408 | (JSON output) Status report of kind S |
M281 | Trigger the watchdog, resetting the printer; X disables the watchdog instead |
M998, M999 | Show interface message S; clear a fatal error (with S, raise one as a test) |
Debugging builds add M512, M533 and
M534.
The 2.0 line
The project describes version 2 as an incompatible rewrite that tries to keep
the commands of 1.0. Its dispatcher on the dev2 branch has cases
for most of the codes above and adds, among others, M0,
M6 (tool change), M7 to M9 (mist and
flood coolant), M39 (card information), M48 (probe
accuracy test), M141 and M191 (chamber
temperature), M319, M357, M524 (abort
the card print), M540 (motion buffer report), M569
(StealthChop), M575 (baud rate), M576 (out of order
execution), M665, M666, M669,
M876 (host prompts), M900 (pressure advance, in
place of M233), M906, M911 to
M913 (Trinamic drivers), M997, M1005
and M9999 (boot loader). Parameters may differ from 1.0 even
where the number is the same.
G codes in 2.0
| Command | Parameters and effect |
|---|---|
G0, G1 | X Y Z E F and the further axes A B C; P sets destination checking, P0 switching it off. A build can give G0 a speed of its own |
G2, G3 | (Arc support) centre offsets I J or radius R, a negative radius taking the arc over 180 degrees; end point X Y Z A B C, E, F |
G4 | Wait for queued moves, then pause; S seconds and P milliseconds are added together |
G10, G11 | (Firmware retraction) retract and recover; with several tools S above 0 selects the long retraction |
G28 | Home; flags X Y Z E A B C |
G30 | (Probe) probe once. P bit 0 activates the probe first, bit 1 deactivates it afterwards (default 3). S measures the probe height with the nozzle taken to be at height Z; otherwise H gives the height of the measured object and R the Z value to assign |
G31, G32, G33 | Report the probe state; run the levelling routine; run a further routine of the levelling code |
G92 | Set origin offsets for the axes given, and the extruder position by E; with no axis, reset the offsets |
G134 | (Nozzle probe, several tools; axes homed) measure tool Z offsets: P reference tool (0), S measure only this tool, Z added correction |
G29, G100, G131 to G133, G135 | Their bodies are commented or compiled out: they do nothing |
M codes in 2.0
These are read from the default handlers in MCodes.cpp; a printer
build can replace any of them.
| Command | Parameters and effect |
|---|---|
M17, M18 | Enable or disable the motors named by X Y Z E; with none, all |
M20 to M30, M32 | Card or file handling: M20 S2 Pfolder lists as JSON; M21 P; M23, M28, M30 and M32 take a name (select, write, delete, make a folder); M24 start or continue; M25 pause, S0 passing “no pause”; M26 S file position |
M27, M155 | Automatic card status or temperature reports every S seconds plus P milliseconds, at most 60 seconds. M27 with neither reports once (C is passed to the report); M155 with neither reports every second |
M36, M39 | File information for a name (JSON); card information, S2 as JSON |
M42 | Pin P: write S (0 to 255) digitally, or without S read it; sensitive pins are refused |
M48 | (All axes homed) probe P times (10) at X Y; report average, minimum, maximum and standard deviation |
M84, M85 | M84 S motor idle time in seconds, without S stop now; M85 S maximum inactivity in seconds |
M92, M201, M202, M207 | Per axis: resolution; print acceleration; travel acceleration; jerk (called yank) |
M99 | Release the motors named by X Y Z for S seconds (10), then enable them |
M104, M109 | Tool T to S degrees plus offset O; the preheat temperature is chosen by P in M104 and by H in M109, which waits |
M140, M190, M141, M191 | Bed or chamber H (without it, all): S degrees or P preheat temperature, plus O; M190 and M191 wait |
M106, M107 | Fan P on at S (255), or off; M106 I nonzero makes fan commands be ignored, I0 ends that; D is a time in seconds handed to the fan control |
M114 | Position; S nonzero adds motor positions, D direction data |
M116 | Wait for all heaters |
M200 | Filament diameter D or R of tool T; 0 ends volumetric extrusion |
M203 | Maximum speed per axis in millimetres per minute; in this source A, B and C take the value of E |
M204 | PID values X Y Z (P, I, D) of heater S, or of the active tool |
M205, M206, M500 to M502 | Print the settings; change one stored value; store, load, restore the configured values |
M218 | Offsets X Y Z of tool T; with no axis, report all |
M220, M221 | Speed and flow percentage S |
M226 | Wait until pin P reads S; X0 makes it a plain input, another X an input with pull-up |
M280 | Ditto printing with S extra copies, R nonzero mirrored where supported |
M300 | Beeper B: S frequency (1000), P milliseconds (1000) |
M302, M303 | Allow cold extrusion (without S or with it nonzero); tune heater P or T |
M319 | Levelling matrix: X Y Z set the diagonal, P (0 to 8) with V any element, S nonzero marks it for storing; report |
M320, M321, M322 | Levelling on (S nonzero stores); off (S3 also resets the matrix); reset the matrix |
M340, M350, M907, M908 | Servo P; microsteps S of motor P; current S of motor P (both M907 and M908) |
M355, M357 | Case light mode S and brightness P; (changeable backlight) R red, E green, B blue, W white, S brightness |
M374, M375 | (Grid levelling) export or import the bump matrix under a file name |
M401, M402, M408 | Remember the position; return to it; (JSON output) status of kind S |
M415 | (Host rescue) S enable, Z replace the Z position; report |
M524, M530, M531, M532 | Abort the print and switch heaters off; printing state S and layer count L; job name (20 characters); progress X percent and layer L |
M539 | S start and stop support; P paused state |
M575, M576 | Baud rate B from the supported list; S out of order execution |
M601 | S above 0 pauses heaters, otherwise resumes them, P nonzero then waiting. B and C add beds and chambers; extruders are included unless E0; with none of the three, all |
M602, M606 | Jam debugging S, jam control off with P; park |
M876 | P says whether the host shows prompts; S is the chosen answer |
M900 | Advance K or L of tool T; ratio of extrusion to travel R, or from W width, H height and D filament diameter |
M163, M164, M170, M232, M460, M600, M604, M890, M909, M910 | The default handler does nothing |
Not covered
For the 2.0 line, the parameters of G32, G33 and
G201 to G205, of the tool commands M3
to M9, and of commands handled outside GCodes.cpp and
MCodes.cpp are not given. For both lines, the settings of each
build that decide which commands exist, the exact reply texts and the EEPROM
positions used with M206 are not given here.
Sources
- Repetier-Firmware, master branch –
Commands.cpp,gcode.cpp,Drivers.cpp,Eeprom.cppand their headers, GNU General Public Licence version 3; this page is written in our own words - Commands.cpp, dev2 branch – the dispatcher of the 2.0 line
- GCodes.cpp and MCodes.cpp, dev2 branch – the command handlers of the 2.0 line, GNU General Public Licence version 3
- README – the project’s account of the versions and the licence