The register of 3D printer commands is the RepRap wiki’s G-code page: new codes are meant to be added there before they are used. This page lists every command in that register, with the Marlin documentation for Marlin’s own codes (G5, G35, G53). The Notes column names the firmware where a code belongs to one firmware or family, or where the same number means different things in different firmwares; “most firmwares” means the command is widely supported. Parameters differ between firmwares and versions, so they are described only for the common commands; the RepRap wiki and each firmware’s documentation give them in full.
Firmware names used: Marlin; Prusa (Prusa’s 8-bit firmware for the MK2 and MK3 series); Prusa Buddy (Prusa’s 32-bit firmware for the MINI, MK4, XL and CORE One); RepRapFirmware (Duet3D); Klipper; Repetier; Smoothieware; Teacup; Sprinter; 5D; Druid; MK4duo; Redeem; Machinekit; Grbl; MakerBot; BFB (Bits from Bytes); Yaskawa.
Parameters of the common commands
| Command | Parameters |
|---|---|
G0, G1 | X Y Z end point, E filament, F feed rate (mm/min); S laser power; at least one parameter |
G2, G3 | End X Y, centre offsets I J from the start point or radius R, E, F; P full circles in Marlin |
G4 | P milliseconds or S seconds |
G28 | Axis letters to home (all when none); O skip if already homed (Marlin) |
G92 | New current value of each named axis, without moving |
M104, M109 | S target temperature (°C); T tool; M109 R waits for heating or cooling (Marlin) |
M140, M190 | S bed temperature; M190 R waits for heating or cooling |
M106 | S fan speed 0 to 255 (RepRapFirmware also 0.0 to 1.0); P fan index |
M107 | P fan index |
M73 | P percent done, R minutes remaining (Prusa also Q, S for silent mode, C minutes to change) |
M117 | The rest of the line is the message |
M204 | P printing, R retract, T travel acceleration (Marlin); S both print and travel |
M220, M221 | S percentage |
M486 | T number of objects, S current object (−1 for none), A name, P cancel object, U uncancel, C cancel current |
Tn | Tool number; Marlin’s MMU adds T?, Tx, Tc |
G commands
| Code | Command | Notes |
|---|---|---|
G0 | Rapid move | Most firmwares; treated the same as G1 by most printer firmwares |
G1 | Linear move | Most firmwares |
G2 | Clockwise arc or circle move | Most firmwares |
G3 | Anticlockwise arc or circle move | Most firmwares |
G4 | Dwell (pause) | Most firmwares |
G5 | Cubic Bézier spline move | Marlin |
G6 | External motion control: a direct stepper move | Marlin 2.1.2; Druid uses G6 for a direct, uninterpolated stepper move |
G10 | Set tool offset, workplace coordinates or tool temperatures | RepRapFirmware, Smoothieware, Machinekit, Yaskawa |
G10 | Retract (firmware retraction) | Marlin, Prusa, Klipper, Repetier, Smoothieware, RepRapFirmware (without parameters), MK4duo |
G11 | Unretract (recover after firmware retraction) | As G10 retract |
G12 | Clean the nozzle | Marlin, MK4duo |
G17 | Select the XY plane for arcs | CNC; Marlin, RepRapFirmware, Grbl, Machinekit |
G18 | Select the ZX plane | As G17 |
G19 | Select the YZ plane | As G17 |
G20 | Units are inches | Most firmwares |
G21 | Units are millimetres | Most firmwares |
G22 | Firmware retract | Machinekit |
G23 | Firmware recover | Machinekit |
G26 | Print a mesh validation pattern | Marlin, Prusa Buddy, MK4duo |
G27 | Park the toolhead | Marlin, Prusa Buddy, Druid, MK4duo |
G28 | Move to origin (home) | Most firmwares |
G29 | Probe the bed and enable levelling compensation | Most firmwares; the method depends on the firmware: Marlin 3-point, linear, bilinear, manual mesh or unified levelling; Repetier auto levelling; RepRapFirmware mesh compensation |
G29.1 | Set Z probe head offset | Machinekit |
G29.2 | Set Z probe head offset calculated from the toolhead position | Machinekit |
G30 | Single Z probe at the current or given point | Most firmwares |
G31 | Set or report current probe status (trigger height and offsets) | RepRapFirmware, Smoothieware, Repetier |
G31 | Dock the Z probe sled | Marlin, Redeem, MK4duo |
G32 | Probe Z and calculate the Z plane (bed levelling) | RepRapFirmware, Smoothieware, Repetier |
G32 | Undock the Z probe sled | Marlin, Redeem, MK4duo |
G33 | Measure, list or adjust the distortion matrix | Repetier, Redeem |
G33 | Delta auto calibration | Marlin, MK4duo |
G34 | Z steppers auto-alignment, or mechanical gantry calibration | Marlin 2.0.4 and later |
G34 | Calculate delta height from the toolhead position | MK4duo |
G35 | Tramming assistant: probe the bed screws and report turns | Marlin |
G38.2 | Probe towards the workpiece, stop on contact, error on failure | CNC; Marlin, RepRapFirmware, Smoothieware, Grbl, Machinekit, MK4duo |
G38.3 | Probe towards the workpiece, stop on contact | As G38.2 |
G38.4 | Probe away from the workpiece, stop on loss of contact, error on failure | CNC; Marlin, RepRapFirmware, Grbl, Machinekit |
G38.5 | Probe away from the workpiece, stop on loss of contact | As G38.4 |
G40 | Cutter compensation off | CNC; Grbl, Machinekit, Yaskawa |
G42 | Move to a point of the levelling mesh | Marlin, Prusa Buddy, MK4duo |
G53 | Move in machine coordinates (ignore workspace offsets) | CNC; Marlin, RepRapFirmware, Smoothieware, Grbl, Machinekit, Yaskawa |
G54–G59 | Select workspace coordinate system 1 to 6 | As G53 |
G59.1–G59.3 | Select workspace coordinate system 7 to 9 | As G53 |
G60 | Save the current position (in a numbered slot) | Marlin, RepRapFirmware, Druid, MK4duo |
G61 | Return to a saved position | Marlin |
G68 | Coordinate rotation | RepRapFirmware 3.4 and later |
G69 | Cancel coordinate rotation | RepRapFirmware 3.4 and later |
G75 | Print temperature interpolation | Prusa |
G76 | Probe (PINDA) temperature calibration | Marlin, Prusa |
G80 | Cancel the current motion mode or canned cycle | CNC; Grbl, Marlin |
G80 | Mesh-based Z probe (mesh bed levelling) | Prusa, Prusa Buddy |
G81 | Report mesh bed levelling status | Prusa |
G82 | Single Z probe at the current location | Prusa |
G83 | Babystep in Z and store to EEPROM | Prusa |
G84 | Undo babystep Z (move the Z axis back) | Prusa |
G85 | Pick best babystep | Prusa |
G86 | Disable babystep correction after homing | Prusa |
G87 | Enable babystep correction after homing | Prusa |
G88 | Reserved | Prusa |
G90 | Absolute positioning | Most firmwares |
G91 | Relative positioning | Most firmwares |
G92 | Set the current position | Most firmwares |
G92.1–G92.3 | Reset or restore coordinate system offsets | CNC; Marlin, Smoothieware, Grbl |
G93 | Feed rate mode: inverse time | CNC; RepRapFirmware 3.5 and later, Grbl, Yaskawa |
G94 | Feed rate mode: units per minute | As G93 |
G98 | Activate farm mode | Prusa |
G99 | Deactivate farm mode | Prusa |
G100 | Calibrate floor or rod radius (delta) | Repetier |
G130 | Set digital potentiometer value | MakerBot |
G131 | Remove offset | Repetier |
G132 | Calibrate endstop offsets | Repetier |
G133 | Measure steps to top | Repetier |
G161 | Home axes to minimum | Teacup, MakerBot |
G162 | Home axes to maximum | Teacup, Prusa Buddy, MakerBot |
G425 | Backlash and toolhead offset calibration with a calibration cube | Marlin, Prusa Buddy |
G | List all G-codes the firmware implements | Redeem; a proposal elsewhere |
M commands
M0 to M99: program flow, CNC, SD card, power and setup
| Code | Command | Notes |
|---|---|---|
M0 | Unconditional stop: wait for the user | Most firmwares |
M1 | Sleep: finish moves, then turn motors and heaters off | RepRapFirmware, Klipper and others; Marlin and Prusa treat it as M0 |
M2 | Program end | Teacup, Grbl, MakerBot, Yaskawa |
M3 | Spindle on clockwise, or laser on | Marlin, RepRapFirmware, Repetier, Smoothieware, Teacup, Grbl, Yaskawa |
M4 | Spindle on anticlockwise, or laser on | Marlin, Repetier, Grbl, Yaskawa |
M5 | Spindle or laser off | As M3 |
M6 | Tool change | Teacup, Yaskawa |
M7 | Mist coolant on | Marlin, Teacup, Grbl, Yaskawa |
M8 | Flood coolant on | As M7 |
M9 | Coolant off | As M7 |
M10 | Vacuum or laser blower on | Marlin 2.0.8 and later, Teacup, Yaskawa |
M11 | Vacuum or laser blower off | As M10 |
M13 | Spindle on clockwise and flood coolant on | Yaskawa |
M16 | Expected printer check: stop if the machine name differs | Marlin, MK4duo |
M17 | Enable (power) stepper motors | Most firmwares |
M18 | Disable stepper motors (same as M84) | Most firmwares |
M20 | List the SD card | Most firmwares |
M21 | Initialise the SD card | Most firmwares |
M22 | Release the SD card | Most firmwares |
M23 | Select an SD file | Most firmwares |
M24 | Start or resume the SD print | Most firmwares |
M25 | Pause the SD print | Most firmwares |
M26 | Set the SD read position | Most firmwares |
M27 | Report SD print status | Most firmwares |
M28 | Begin writing to an SD file | Most firmwares |
M29 | Stop writing to the SD file | Most firmwares |
M30 | Delete a file on the SD card | Most printer firmwares |
M30 | Program stop | CNC; Grbl, Yaskawa |
M31 | Report the print time | Marlin, Prusa, Prusa Buddy, MK4duo |
M32 | Select a file and start the SD print | Marlin, Prusa, Prusa Buddy, Smoothieware, RepRapFirmware, MK4duo |
M33 | Get the long name of an SD file or folder | Marlin |
M33 | Stop, close the file and save restart.gcode | MK4duo |
M34 | Set SD file sorting options | Marlin, Druid, MK4duo |
M35 | Upload Nextion display firmware from SD | MK4duo |
M36 | Return file information (JSON) | RepRapFirmware |
M36.1 | Return embedded thumbnail data | RepRapFirmware 3.4 and later |
M37 | Simulation mode | RepRapFirmware |
M38 | Compute the SHA1 hash of a file | RepRapFirmware |
M39 | Report SD card information | RepRapFirmware, MK4duo |
M40 | Eject the finished part | Proposed; RepRapFirmware runs a macro file M40.g |
M41 | Loop the print | Proposed; RepRapFirmware uses while instead |
M42 | Set an I/O pin | Marlin, Prusa, Prusa Buddy, Repetier, RepRapFirmware, Sprinter, MK4duo |
M43 | Stand by on material exhausted | Proposed |
M43 | Pin report and debugging; M43 T toggles pins | Marlin, MK4duo |
M44 | Codes debug: report the codes available | MK4duo |
M44 | Reset the bed skew and offset calibration | Prusa |
M45 | Bed skew and offset calibration with manual Z up | Prusa |
M46 | Show the assigned IP address | Prusa, Prusa Buddy |
M47 | Show the endstops dialogue on the display | Prusa |
M48 | Measure Z probe repeatability | Marlin, Prusa, Smoothieware, MK4duo |
M49 | Set the G26 debug flag | MK4duo |
M70 | Display a message | MakerBot |
M72 | Play a tone or song | MakerBot |
M72 | Set or get the printer state | Prusa |
M73 | Set or get print progress | Marlin, Prusa, Prusa Buddy, RepRapFirmware 3.3 and later, MakerBot, MK4duo |
M74 | Set the weight on the print bed | Prusa Buddy |
M75 | Start the print job timer | Marlin, Prusa, Prusa Buddy, Druid, MK4duo |
M76 | Pause the print job timer | As M75 |
M77 | Stop the print job timer | As M75 |
M78 | Show print job statistics | Marlin, Prusa, Prusa Buddy, MK4duo |
M79 | Start the host timer | Prusa |
M80 | Power supply (ATX) on | Most firmwares |
M81 | Power supply (ATX) off | Most firmwares |
M82 | Extruder in absolute mode | Most firmwares |
M83 | Extruder in relative mode | Most firmwares |
M84 | Stop idle hold (disable motors), or set the idle timeout with S | Most firmwares |
M85 | Set the inactivity shutdown timer | Marlin, Prusa, Prusa Buddy, Repetier, Sprinter, MK4duo |
M86 | Set the safety (hotend idle) timeout | Marlin 2.1.3, Prusa, Prusa Buddy |
M87 | Cancel the safety timer | Marlin 2.1.3 |
M92 | Set axis steps per unit | Most firmwares |
M93 | Send axis steps per unit to the host | Sprinter |
M98 | Call a macro or subprogram | RepRapFirmware, Yaskawa |
M99 | Return from a macro or subprogram | RepRapFirmware, Yaskawa |
M100 to M199: temperatures, fans, reports and messages
| Code | Command | Notes |
|---|---|---|
M100 | Report free memory | Marlin |
M101 | Turn extruder 1 on (forward), undo retraction | Teacup, BFB; obsolete |
M102 | Turn extruder 1 on (reverse) | BFB |
M102 | Configure the bed distance sensor | Marlin 2.1.1 |
M103 | Turn all extruders off, extruder retraction | Teacup, BFB; obsolete |
M104 | Set hotend temperature (do not wait) | Most firmwares |
M105 | Report temperatures | Most firmwares |
M106 | Fan on, set fan speed | Most firmwares |
M107 | Fan off | Most firmwares |
M108 | Cancel heating; break out of a waiting loop | Marlin, Prusa Buddy, RepRapFirmware, Redeem, MK4duo |
M108 | Set extruder speed | BFB |
M109 | Set hotend temperature and wait | Most firmwares; MakerBot and Teacup read it differently |
M110 | Set the current line number | Most firmwares |
M111 | Set debug level | Marlin, Prusa Buddy, Repetier, RepRapFirmware, Redeem, MK4duo, 5D |
M112 | Full (emergency) stop | Most firmwares |
M113 | Set extruder PWM | 5D |
M113 | Host keepalive interval | Marlin 1.1.9 and later, Prusa, Prusa Buddy, MK4duo |
M114 | Report the current position | Most firmwares |
M115 | Report firmware version and capabilities | Most firmwares |
M116 | Wait for all temperatures and slow variables | RepRapFirmware, Repetier, Teacup, MakerBot, Redeem, MK4duo, 5D |
M117 | Get zero position | 5D |
M117 | Display a message on the screen | Most firmwares |
M118 | Echo a message to the host | Marlin 1.1.4 and later, Prusa Buddy, RepRapFirmware, Klipper, MK4duo |
M118 | Negotiate features | Proposed |
M119 | Report endstop status | Most firmwares |
M120 | Push the machine state | RepRapFirmware, Smoothieware |
M120 | Enable endstop detection | Marlin, Prusa, Prusa Buddy, MK4duo |
M121 | Pop the machine state | RepRapFirmware, Smoothieware |
M121 | Disable endstop detection | Marlin, Prusa, Prusa Buddy, MK4duo |
M122 | Diagnose | RepRapFirmware |
M122 | Set software endstop | MK4duo |
M122 | Debug (TMC) stepper drivers | Marlin, Prusa Buddy |
M123 | Report fan tachometer values | Marlin, Prusa, Prusa Buddy |
M123 | Endstop logic | MK4duo |
M124 | Immediate motor stop | MK4duo |
M124 | Set endstop pull-up | MK4duo |
M125 | Park the head (save position, move to the change position) | Marlin, Prusa Buddy |
M125 | Pause print | Prusa, Prusa Buddy |
M126 | Open valve (Baricuda 1 in Marlin) | Marlin, MakerBot, MK4duo, 5D; MakerBot reads it as an extra output |
M127 | Close valve (Baricuda 1 in Marlin) | As M126 |
M128 | Extruder pressure PWM (Baricuda 2 open in Marlin) | Marlin, MK4duo |
M129 | Extruder pressure off (Baricuda 2 close in Marlin) | Marlin, MK4duo |
M130 | Set PID P value | Teacup |
M131 | Set PID I value | Teacup |
M132 | Set PID D value | Teacup; MakerBot uses it to load axis offsets from EEPROM |
M133 | Set PID I limit value | Teacup; MakerBot: wait for toolhead temperature |
M134 | Write PID values to EEPROM | Teacup; MakerBot: wait for bed temperature |
M135 | Set PID sample interval | RepRapFirmware; MakerBot: change tool |
M136 | Print PID settings to the host | Teacup (debug) |
M140 | Set bed temperature (do not wait) | Most firmwares |
M141 | Set chamber temperature (do not wait) | Marlin, RepRapFirmware, Machinekit, MK4duo |
M142 | Holding pressure | Proposed |
M142 | Set cooler temperature | MK4duo |
M143 | Set laser cooler temperature | Marlin 2.0.8 and later |
M143 | Maximum heater temperature | RepRapFirmware |
M144 | Bed standby | RepRapFirmware |
M145 | Set material presets in the LCD menu | Marlin |
M146 | Set chamber humidity | Proposed |
M147 | Set filtration required for the current print | Prusa Buddy 6.4.0 |
M148 | Disable filtration for the current print | Prusa Buddy 6.4.0 |
M149 | Set temperature units (Celsius, Fahrenheit, Kelvin) | Marlin |
M150 | Set LED colour | Marlin and others |
M154 | Position auto-report | Marlin |
M155 | Temperature auto-report | Marlin and others |
M160 | Number of mixed materials | Superseded by M563; no current firmware |
M163 | Set the weight of one mixed material | Marlin and others |
M164 | Store the mix weights as a virtual tool | Marlin and others |
M165 | Set several mix weights | Marlin and others |
M166 | Set a gradient mix | Marlin |
M190 | Set bed temperature and wait | Most firmwares |
M191 | Set chamber temperature and wait | Marlin 2.0 and later, RepRapFirmware 1.17 and later, Machinekit, MK4duo |
M192 | Wait for the probe temperature | Marlin |
M193 | Set laser cooler temperature and wait | Marlin 2.0.8 and later |
M200 to M299: motion settings, retraction, servos and I²C
| Code | Command | Notes |
|---|---|---|
M200 | Set filament diameter (volumetric extrusion) | Most firmwares |
M201 | Set maximum acceleration | Most firmwares |
M201.1 | Set reduced acceleration for special move types | RepRapFirmware 3.4 and later |
M202 | Set maximum travel acceleration | Marlin (older), Prusa, Repetier, Sprinter, MK4duo |
M203 | Set maximum feed rate | Most firmwares |
M203 | Set temperature monitor | Repetier |
M204 | Set default (starting) acceleration | Most firmwares |
M204 | Set PID values | Repetier |
M205 | Advanced settings: jerk, minimum speeds, junction deviation | Marlin, Prusa, Prusa Buddy, Smoothieware, Sprinter, MK4duo |
M205 | EEPROM report | Repetier |
M206 | Set home offsets | Marlin, Prusa, Prusa Buddy, RepRapFirmware, Smoothieware, Redeem, Sprinter, MK4duo |
M206 | Set an EEPROM value | Repetier |
M207 | Set firmware retraction length and speed | Marlin, Prusa, Prusa Buddy, RepRapFirmware, Smoothieware, Machinekit, MK4duo, Yaskawa |
M207 | Calibrate the Z axis with the Z maximum endstop | Proposed |
M207 | Set jerk without saving to EEPROM | Repetier |
M208 | Set firmware unretract (recover) length and speed | Marlin, Prusa, Prusa Buddy, Smoothieware, MK4duo |
M208 | Set axis limits (maximum travel) | RepRapFirmware |
M209 | Enable automatic retraction | Marlin, Prusa, Prusa Buddy, Repetier, MK4duo |
M210 | Set homing feed rates | Marlin 2.1.3 and later |
M211 | Disable or enable software endstops | Marlin, Prusa Buddy |
M212 | Set bed level sensor offset | Marlin |
M214 | Set arc configuration values | Prusa |
M217 | Tool change (filament swap) parameters | Marlin, Prusa Buddy |
M218 | Set hotend offset | Marlin, Prusa Buddy, MK4duo |
M220 | Set speed factor override percentage | Most firmwares |
M220 | Turn off AUX V1.0.5 | BFB |
M221 | Set extrude factor (flow) override percentage | Most firmwares |
M221 | Turn on AUX V1.0.5 | BFB |
M222 | Set speed of fast XY moves | BFB |
M223 | Set speed of fast Z moves | BFB |
M224 | Enable extruder during fast moves | BFB |
M225 | Disable extruder during fast moves | BFB |
M226 | G-code initiated pause | RepRapFirmware, BFB, Machinekit |
M226 | Wait for a pin state | Marlin, Prusa, Prusa Buddy, Repetier, MK4duo |
M227 | Enable automatic reverse and prime | Proposed (no current firmware) |
M228 | Disable automatic reverse and prime | As M227 |
M229 | Enable automatic reverse and prime | As M227 |
M230 | Disable or enable waiting for temperature change | As M227 |
M231 | Set OPS parameter | Repetier |
M232 | Read and reset maximum advance values | Repetier |
M240 | Trigger a camera | Marlin, MK4duo |
M240 | Start conveyor belt motor; echo off | Teacup (echo off, debug) |
M241 | Stop conveyor belt motor; echo on | Teacup (echo on, debug) |
M245 | Start cooler | Proposed |
M246 | Stop cooler | Proposed |
M250 | Set LCD contrast | Marlin, Prusa, Prusa Buddy, MK4duo |
M251 | Measure Z steps from the homing stop (delta) | Repetier |
M255 | Set LCD sleep (backlight) timeout | Marlin |
M256 | Set LCD brightness | Marlin 2.0.9.3 |
M260 | Send data on the I²C bus | Marlin 1.1 and later, Prusa Buddy, RepRapFirmware 1.21 and later, MK4duo |
M260.1 | Modbus: write registers | RepRapFirmware 3.6 and later |
M261 | Request data from the I²C bus | As M260 |
M261.1 | Modbus: read input registers | RepRapFirmware 3.6 and later |
M265 | Scan the I²C bus | Marlin 2.1.3 |
M280 | Set servo position | Marlin, RepRapFirmware 1.16 and later, Machinekit, Redeem, MK4duo |
M281 | Set servo deploy and stow angles | Marlin 2.0 |
M282 | Detach a servo | Marlin 2.0.9.2 |
M290 | Babystepping | Marlin 1.1.7 and later, Prusa Buddy, Repetier, RepRapFirmware 1.18 and later, MK4duo |
M291 | Display a message and optionally wait for a response | RepRapFirmware 1.19 and later |
M292 | Acknowledge a message | RepRapFirmware 1.19 and later |
M293 | Babystep Z up | Marlin 2.1.3 |
M294 | Babystep Z down | Marlin 2.1.3 |
M300 to M399: sound, PID, heaters, microstepping and kinematics
| Code | Command | Notes |
|---|---|---|
M300 | Play a beep | Most firmwares |
M301 | Set hotend PID parameters | Most firmwares |
M302 | Allow cold extrusion, or set the minimum extrusion temperature | Marlin, Prusa, Prusa Buddy, Repetier, RepRapFirmware, MK4duo |
M303 | Run PID tuning | Most firmwares |
M304 | Set bed PID parameters | Marlin, Prusa, Prusa Buddy, RepRapFirmware; RepRapPro’s Marlin used it for thermistor values |
M305 | Set thermistor and ADC parameters | Marlin, Smoothieware, RepRapFirmware (before 3.0), MK4duo |
M306 | Set home offset calculated from the toolhead position | Smoothieware |
M306 | Model predictive temperature control (MPC) settings | Marlin |
M307 | Set or report heating process parameters | RepRapFirmware 1.15 and later |
M308 | Set or report sensor parameters | RepRapFirmware 3.0 and later |
M309 | Set or report heater feedforward | RepRapFirmware 3.4 and later |
M309 | Set chamber PID | Marlin |
M310 | Temperature model settings | Prusa |
M320 | Activate autolevel | Repetier |
M321 | Deactivate autolevel | Repetier |
M322 | Reset the autolevel matrix | Repetier |
M323 | Distortion correction on or off | Repetier |
M340 | Control the servos | Repetier |
M350 | Set microstepping mode | Marlin, Prusa, Prusa Buddy, Repetier, RepRapFirmware, Redeem, MK4duo |
M351 | Toggle the MS1 and MS2 pins directly | Marlin, MK4duo |
M355 | Case light on or off, brightness | Marlin 1.1 and later, Prusa Buddy, Repetier |
M360 | Report firmware configuration | Repetier 0.92.2 and later, Druid |
M360 | SCARA: move to theta 0° | Marlin, Smoothieware, MK4duo |
M361 | SCARA: move to theta 90° | Marlin, Smoothieware, MK4duo |
M362 | SCARA: move to psi 0° | Marlin, Smoothieware, MK4duo |
M363 | SCARA: move to psi 90° | Marlin, Smoothieware, MK4duo |
M364 | SCARA: move to psi + theta 90° | Marlin, Smoothieware, MK4duo |
M365 | SCARA scaling factor | Marlin, Smoothieware, MK4duo |
M366 | SCARA convert trim | Smoothieware |
M370 | Morgan manual bed level: clear the map | Smoothieware |
M371 | Move to the next calibration position | Smoothieware |
M372 | Record the calibration value and move to the next position | Smoothieware |
M373 | End bed level calibration mode | Smoothieware |
M374 | Save the calibration grid | Smoothieware, RepRapFirmware 1.17 and later |
M375 | Display or load the matrix | Smoothieware, RepRapFirmware 1.17 and later |
M376 | Set bed compensation taper | Smoothieware, RepRapFirmware 1.17 and later |
M380 | Activate a solenoid | Marlin, MK4duo |
M381 | Disable all solenoids | Marlin, MK4duo |
M400 to M499: moves, probes, filament, levelling and printer modes
| Code | Command | Notes |
|---|---|---|
M400 | Wait for current moves to finish | Most firmwares |
M401 | Deploy the Z probe | Marlin, RepRapFirmware, MK4duo |
M402 | Stow the Z probe | Marlin, RepRapFirmware, MK4duo |
M403 | Set filament type for an extruder and notify the MMU | Marlin, Prusa, Prusa Buddy |
M404 | Filament width sensor: nominal diameter | Marlin, RepRapFirmware, MK4duo |
M405 | Filament width sensor on | Marlin, MK4duo |
M406 | Filament width sensor off | Marlin, MK4duo |
M407 | Report filament diameter | Marlin, Prusa, RepRapFirmware, MK4duo |
M408 | Report a JSON-style response | RepRapFirmware, MK4duo |
M409 | Query the object model | RepRapFirmware 3.01 and later |
M410 | Quick stop all steppers | Marlin 1.1 and later, Prusa Buddy, MK4duo |
M412 | Filament runout detection on or off | Marlin 2.0 and later |
M413 | Power-loss recovery on or off | Marlin 2.0 and later |
M414 | Set LCD language | Marlin |
M415 | Host rescue | Repetier |
M416 | Power loss | Repetier |
M420 | Set RGB colours as PWM | Machinekit |
M420 | Bed levelling state: on, off, fade height | Marlin |
M420 | Mesh bed levelling status | Prusa |
M421 | Set one mesh Z value | Marlin |
M422 | Set a Z motor position for G34 | Marlin 2.0.4 and later |
M423 | X-axis twist compensation | Marlin 2.0.9.4 and later |
M424 | Global Z offset | Marlin 2.1.2 and later |
M425 | Backlash compensation | Marlin 2.0 and later, RepRapFirmware 3.5 and later |
M428 | Set home offsets from the current position | Marlin |
M430 | Power monitor: current, voltage and power | Marlin |
M450 | Report printer mode | Repetier, RepRapFirmware 1.20 and later |
M451 | Select FFF printer mode | As M450 |
M452 | Select laser mode | As M450 |
M453 | Select CNC mode | As M450 |
M460 | Temperature range for a thermistor-controlled fan | Repetier |
M470 | Create a directory on the SD card | RepRapFirmware 2.03 |
M471 | Rename a file or directory on the SD card | RepRapFirmware |
M472 | Delete a file or directory on the SD card | RepRapFirmware |
M486 | Label and cancel objects | Marlin, Prusa Buddy, RepRapFirmware 3.01 and later |
M493 | Fixed-time motion and input shaping | Marlin 2.1.3 |
M494 | Fixed-time motion trajectory smoothing | Marlin 2.1.3 |
M495, M496 | Resonance test for input shaping | Marlin |
M500 to M599: settings, security, network and RepRapFirmware configuration
| Code | Command | Notes |
|---|---|---|
M500 | Store settings in non-volatile memory | Most firmwares |
M501 | Read settings from EEPROM | Most firmwares |
M502 | Restore default (factory) settings | Most firmwares |
M503 | Report current settings | Marlin, Prusa, Prusa Buddy, Druid, Sprinter |
M504 | Validate EEPROM contents | Marlin 1.1.9 and later, Prusa Buddy, MK4duo |
M505 | Clear EEPROM and reset the printer | MK4duo |
M505 | Set the configuration file folder | RepRapFirmware 2.03 |
M505 | Set a named EEPROM value | Prusa |
M509 | Force language selection | Prusa |
M510 | Lock the machine | Marlin, Druid |
M511 | Unlock the machine with the passcode | Marlin, Druid |
M512 | Set the passcode | Marlin, Druid |
M513 | Remove the password | Druid |
M524 | Abort the SD print | Marlin 2.0 and later, Druid |
M530 | Enable printing mode | Repetier, MK4duo |
M531 | Set print name | Repetier, MK4duo |
M532 | Set print progress | Repetier, MK4duo |
M540 | Set MAC address | RepRapFirmware |
M540 | Stop the SD print when an endstop is hit | Marlin, Prusa Buddy, Druid, MK4duo |
M544 | G-code parser options (case sensitivity) | Druid |
M550 | Set machine name | Marlin 2.1.3, Druid, RepRapFirmware, MK4duo |
M551 | Set password | Marlin, Druid, RepRapFirmware, MK4duo |
M552 | Set IP address, enable or disable the network interface | Marlin 2.0.8, Prusa, RepRapFirmware, MK4duo |
M553 | Set netmask | Marlin 2.0.8, RepRapFirmware, MK4duo |
M554 | Set gateway or DNS server | Marlin 2.0.8, RepRapFirmware, MK4duo |
M555 | Set compatibility (which firmware’s replies to imitate) | RepRapFirmware, MK4duo |
M555 | Set print bounding box | Prusa Buddy |
M556 | Axis (skew) compensation | RepRapFirmware, MK4duo |
M556 | Override active modular bedlets | Prusa Buddy |
M557 | Set Z probe point or define the probing grid | Smoothieware, RepRapFirmware, MK4duo |
M557 | Set modular bed | Prusa Buddy |
M558 | Set Z probe type | RepRapFirmware, MK4duo |
M558.1 | Calibrate height against reading for an analogue Z probe | RepRapFirmware 3.5 and later |
M558.2 | Set, report or calibrate drive current for an analogue Z probe | RepRapFirmware 3.5 and later |
M558.3 | Set touch mode parameters for an analogue Z probe | RepRapFirmware 3.6 and later |
M558.4 | Tare a load cell probe | RepRapFirmware 3.7 and later |
M559 | Upload a configuration file | RepRapFirmware, MK4duo |
M560 | Upload a web page file | RepRapFirmware, MK4duo |
M561 | Set identity transform (clear bed compensation) | Smoothieware, RepRapFirmware, Redeem |
M562 | Reset a temperature fault | RepRapFirmware, Redeem |
M563 | Define or remove a tool | RepRapFirmware, MK4duo |
M564 | Limit axes to their travel | RepRapFirmware, MK4duo |
M565 | Set Z probe offset | Smoothieware |
M566 | Set allowable instantaneous speed change (jerk) | RepRapFirmware, MK4duo |
M567 | Set tool mix ratios | RepRapFirmware, MK4duo |
M568 | Tool settings (temperatures, spindle speed) | RepRapFirmware 3.3 and later |
M568 | Turn tool mix ratios off or on | Older RepRapFirmware, MK4duo; obsolete meaning |
M569 | Stepper driver control (direction, mode, timings); in Marlin, TMC stepping mode | RepRapFirmware, Marlin, MK4duo |
M569.1 | Stepper driver closed-loop configuration | RepRapFirmware |
M569.2 | Read or write any stepper driver register | RepRapFirmware |
M569.3 | Read the motor driver encoder | RepRapFirmware |
M569.4 | Set motor driver torque mode | RepRapFirmware |
M569.5 | Collect data from a closed-loop driver | RepRapFirmware 3.4 and later |
M569.6 | Run a closed-loop driver tuning move | RepRapFirmware 3.4 and later |
M569.7 | Configure the motor brake port | RepRapFirmware 3.4 and later |
M569.8 | Read axis force | RepRapFirmware 3.5 and later |
M569.9 | Set the driver sense resistor and maximum current | RepRapFirmware (STM32 builds) |
M570 | Configure heater fault detection | RepRapFirmware, MK4duo |
M571 | Set an output to follow extrusion | RepRapFirmware |
M572 | Set or report extruder pressure advance | RepRapFirmware, Prusa Buddy, MK4duo |
M573 | Report heater PWM | RepRapFirmware 3.3 and earlier, MK4duo |
M574 | Set endstop configuration | RepRapFirmware, MK4duo |
M575 | Set serial communication parameters (baud rate) | Marlin 2.0 and later, RepRapFirmware |
M576 | Set SPI communication parameters | RepRapFirmware |
M577 | Wait until an endstop is triggered | RepRapFirmware |
M578 | Fire inkjet bits | RepRapFirmware |
M579 | Scale Cartesian axes | RepRapFirmware |
M580 | Select Roland (mill) mode | RepRapFirmware |
M581 | Configure an external trigger | RepRapFirmware |
M582 | Check an external trigger | RepRapFirmware |
M584 | Set drive mapping | RepRapFirmware 1.14 and later |
M585 | Probe a tool | RepRapFirmware 1.20 and later |
M586 | Configure network protocols | RepRapFirmware 1.18 and later |
M586.4 | Configure the MQTT server | RepRapFirmware 3.5 and later |
M587 | Store a Wi-Fi network, or list stored networks | RepRapFirmware 1.19 and later |
M588 | Forget a Wi-Fi network | RepRapFirmware 1.19 and later |
M589 | Configure access point parameters | RepRapFirmware 1.19 and later |
M590 | Report the current tool type and index | Proposed |
M591 | Configure filament monitoring | RepRapFirmware 1.21 and later, Prusa Buddy |
M592 | Configure nonlinear extrusion | Marlin 2.1.3 and later, RepRapFirmware 1.20.1 and later |
M593 | Configure input shaping | Marlin, Prusa Buddy, RepRapFirmware 3.4 and later |
M594 | Enter or leave height following mode | RepRapFirmware 3.0 and later |
M595 | Set movement queue length | RepRapFirmware 3.2 and later |
M596 | Select movement queue number | RepRapFirmware 3.5 and later |
M597 | Collision avoidance | RepRapFirmware 3.5 and later |
M598 | Synchronise motion systems | RepRapFirmware 3.5 and later |
M599 | Define a keep-out zone | RepRapFirmware 3.5 and later |
M600 to M999: filament, kinematics, MMU, drivers and expansion
| Code | Command | Notes |
|---|---|---|
M600 | Set line cross-section | Machinekit |
M600 | Filament change pause | Marlin, Prusa, Smoothieware, RepRapFirmware 2.02 and later, MK4duo |
M601 | Pause print | Prusa, Prusa Buddy, RepRapFirmware 3.01 and later |
M602 | Resume print | Prusa, Prusa Buddy |
M603 | Stop print | Prusa |
M603 | Configure filament change | Marlin, Prusa Buddy |
M604 | Abort serial print | Prusa Buddy |
M605 | Dual X-carriage or multi-nozzle mode | Marlin, MK4duo |
M606 | Fork the input file reader | RepRapFirmware |
M650 | Set peel move parameters | RepRapFirmware 2.02 |
M651 | Execute a peel move | RepRapFirmware 2.02 |
M655 | Send a request to a custom CAN expansion board | RepRapFirmware 3.6 |
M665 | Set delta (or SCARA in Marlin) configuration | Marlin, Smoothieware, RepRapFirmware, MK4duo |
M666 | Set delta endstop adjustment; in Marlin also dual endstop offsets | Marlin, Repetier, Smoothieware, RepRapFirmware, MK4duo |
M667 | Select CoreXY mode | RepRapFirmware, MK4duo |
M668 | Set Z-offset compensation polynomial | Experimental (a RepRapFirmware fork) |
M669 | Set kinematics type and parameters | RepRapFirmware 1.19 and later |
M670 | Set I/O port bit mapping | RepRapFirmware 1.19 and later |
M671 | Define positions of Z leadscrews or bed levelling screws | RepRapFirmware 1.19 and later |
M672 | Program the Z probe (Duet Smart Effector sensitivity) | RepRapFirmware 1.19 and later, Marlin |
M673 | Align plane on a rotary axis | RepRapFirmware 2.02 and later |
M674 | Set Z to the centre point | Proposed |
M675 | Find the centre of a cavity | RepRapFirmware 2.02 and later |
M700 | Level plate | Proposed |
M701 | Load filament | Marlin, Prusa, Prusa Buddy, RepRapFirmware 1.19 and later, MK4duo |
M702 | Unload filament | As M701 |
M703 | Configure filament | RepRapFirmware |
M704 | Preload filament to the MMU | Prusa, Prusa Buddy |
M705 | Eject filament (MMU) | Prusa, Prusa Buddy |
M706 | Cut filament (MMU) | Prusa, Prusa Buddy |
M707 | Read an MMU register | Prusa, Prusa Buddy |
M708 | Write an MMU register | Prusa, Prusa Buddy |
M709 | MMU power and reset | Prusa, Prusa Buddy |
M710 | Controller fan settings | Marlin 2.0.5.2 and later |
M710 | Erase the EEPROM and reset the board | Proposed |
M711 | Calibrate pressure advance | Proposed |
M750 | Enable the 3D scanner extension | RepRapFirmware 1.18 and later |
M751 | Register a 3D scanner extension over USB | As M750 |
M752 | Start a 3D scan | As M750 |
M753 | Cancel the current 3D scanner action | As M750 |
M754 | Calibrate the 3D scanner | As M750 |
M755 | Set alignment mode for the 3D scanner | As M750 |
M756 | Shut down the 3D scanner | As M750 |
M800 | Run the start print procedure | bq’s Marlin only |
M801 | Run the end print procedure | bq’s Marlin only |
M808 | Set or go to a repeat marker (loop part of a file) | Marlin 2.0.8 and later |
M810–M819 | Set or run one of ten temporary G-code macros | Marlin 2.0 and later |
M820 | Report the temporary G-code macros | Marlin 2.1.3 and later |
M850 | Sheet parameters | Prusa |
M851 | Set Z (or XYZ) probe offset | Marlin, Prusa, Prusa Buddy, RepRapFirmware 2.02 and later, MK4duo; parameters differ by version |
M852 | Bed skew compensation | Marlin |
M855 | Set axis length | Proposed |
M860 | Wait for probe temperature | Prusa |
M860–M869 | I²C position encoders | Marlin |
M861 | Set probe thermal compensation | Prusa |
M862 | Print checking | Prusa, Prusa Buddy |
M862.1 | Check nozzle diameter | Prusa, Prusa Buddy |
M862.2 | Check model code | Prusa, Prusa Buddy |
M862.3 | Check model name | Prusa, Prusa Buddy |
M862.4 | Check firmware version | Prusa, Prusa Buddy |
M862.5 | Check G-code level | Prusa, Prusa Buddy |
M862.6 | Check firmware features | Prusa Buddy |
M863 | Tool remapping | Prusa Buddy |
M870 | Open or close the automatic chamber vent | Prusa Buddy |
M871 | Probe temperature compensation configuration | Marlin |
M876 | Handle a host prompt response | Marlin, Druid, MK4duo |
M890 | Run user G-code | MK4duo |
M900 | Set linear advance factor | Marlin 1.1 and later, Prusa, MK4duo, Yaskawa |
M905 | Set local date and time | Druid, RepRapFirmware 1.16 and later |
M906 | Set motor currents | Marlin, RepRapFirmware, Redeem |
M907 | Set digital trimpot motor current | Marlin, Prusa, Smoothieware, Druid, Repetier, Redeem, MK4duo |
M908 | Control a digital trimpot directly | Marlin, Repetier 0.92, MK4duo |
M909 | Set microstepping | Redeem; Marlin: report DAC stepper current |
M910 | Set decay mode | Redeem; Marlin: commit DAC to EEPROM |
M910 | TMC2130 initialisation | Prusa |
M911 | Configure auto save on power loss (power panic) | RepRapFirmware 1.20 and later |
M911 | Set TMC2130 holding currents | Prusa |
M911 | Report TMC over-temperature pre-warning | Marlin |
M912 | Set electronics temperature monitor adjustment | RepRapFirmware |
M912 | Set TMC2130 running currents | Prusa |
M912 | Clear TMC over-temperature pre-warning | Marlin |
M913 | Set motor current as a percentage of normal | RepRapFirmware |
M913 | Set hybrid (PWM) threshold speed | Marlin |
M913 | Print TMC2130 currents | Prusa |
M914 | Set or get expansion voltage level translator | RepRapFirmware (Alligator board only) |
M914 | Set TMC2130 normal mode | Prusa |
M914 | Set StallGuard sensitivity (sensorless homing threshold) | Marlin |
M915 | Configure motor stall detection | RepRapFirmware 1.20 and later |
M915 | Set TMC2130 silent mode | Prusa |
M915 | TMC Z axis calibration | Marlin |
M916 | Resume print after power failure | RepRapFirmware 1.20 and later |
M916 | Set TMC2130 StallGuard sensitivity threshold | Prusa |
M916 | L6474 thermal warning test | Marlin |
M917 | Set motor standstill current reduction | RepRapFirmware 1.20 and later |
M917 | Set TMC2130 PWM amplitude offset | Prusa |
M917 | L6474 overcurrent warning test | Marlin |
M918 | Configure a direct-connect display | RepRapFirmware 1.21 and later |
M918 | Set TMC2130 PWM amplitude gradient | Prusa |
M918 | L6474 speed warning test | Marlin |
M919 | TMC chopper timing | Marlin |
M920 | TMC homing current | Marlin 2.1.3 |
M928 | Start logging serial input to an SD file | Marlin, Prusa, MK4duo |
M929 | Start or stop event logging to the SD card | RepRapFirmware 1.20 and later, Prusa |
M950 | Create a heater, fan, GPIO or servo device | RepRapFirmware 3.0 and later |
M951 | Set height following mode parameters | RepRapFirmware 3.0 and later |
M951 | Magnetic parking extruder settings | Marlin |
M952 | Set CAN expansion board address or data rate | RepRapFirmware 3.0 and later |
M953 | Set CAN-FD fast data rate | RepRapFirmware 3.7 and later |
M954 | Configure as a CAN expansion board | RepRapFirmware 3.3 and later |
M955 | Configure an accelerometer | RepRapFirmware 3.4 and later |
M956 | Collect accelerometer data and write it to a file | RepRapFirmware 3.4 and later |
M957 | Raise an event | RepRapFirmware 3.4 and later |
M958 | Excite harmonic vibration | Proposed (provisional parameters) |
M959 | Configure CAN expansion board behaviour | RepRapFirmware 3.7 and later |
M970 | Enable or disable phase stepping | RepRapFirmware, Prusa Buddy |
M970.1 | Phase stepping velocity constant | RepRapFirmware |
M970.2 | Phase stepping acceleration constant | RepRapFirmware |
M970.3 | Phase stepping waveform correction | RepRapFirmware |
M972 | Retrieve current correction | Prusa Buddy |
M973 | Set one entry of the current correction table | Prusa Buddy |
M974 | Measure print head resonance | Prusa Buddy |
M975 | Measure the accelerometer sampling frequency | Prusa Buddy |
M976 | Measure print head resonance | Prusa Buddy |
M977 | Calibrate a motor | Prusa Buddy |
M993 | Back up SPI flash settings to SD | Marlin |
M994 | Restore SPI flash from SD | Marlin |
M995 | Calibrate the touch screen | Marlin 2.0.6 and later |
M997 | Perform an in-application firmware update | Marlin 2.0 and later, RepRapFirmware |
M998 | Request a resend of a line | RepRapFirmware |
M999 | Restart after being stopped by an error | Marlin, Smoothieware, RepRapFirmware, MK4duo |
M7219 | Control MAX7219 LED matrix | Marlin |
M | List all M-codes the firmware implements | Redeem; a proposal elsewhere |
T commands
| Code | Command | Notes |
|---|---|---|
Tn | Select tool n, or report the current tool; RepRapFirmware runs the tool-change macros, with P a bitmap of which to run | Most firmwares; Marlin documents T0–T7 |
T? | MMU2: the user chooses the filament on the printer | Marlin, Prusa |
Tx | MMU2: prepare the chosen filament for loading | Marlin, Prusa |
Tc | MMU2: load the prepared filament to the nozzle | Marlin, Prusa |
D commands (Prusa debug)
| Code | Command |
|---|---|
D-1 | Endless loop |
D0 | Reset |
D1 | Clear EEPROM and reset |
D2 | Read or write RAM |
D3 | Read or write EEPROM |
D4 | Read or write a pin |
D5 | Read or write flash |
D6 | Read or write external flash |
D7 | Read or write the bootloader |
D8 | Read or write PINDA probe values |
D9 | Read or write ADC values |
D10 | Set XYZ calibration as done |
D12 | Time |
D20 | Generate an offline crash dump |
D21 | Print the crash dump to serial |
D22 | Clear the crash dump state |
D23 | Request an emergency dump on serial |
D80 | Bed check |
D81 | Bed analysis |
D106 | Print measured fan speed for different PWM values |
D2130 | Trinamic stepper controller |
D9125 | PAT9125 filament sensor |
What is not covered
Firmware-specific parameters for every command are not repeated here; the RepRap
wiki gives them per firmware. Klipper accepts a subset of these codes and adds
extended commands written as words (SET_PRESSURE_ADVANCE,
EXCLUDE_OBJECT and others), which are defined by its configuration
and are not part of this register.