These Marlin commands pause and resume a job, drive the motors, spindle and power supply, work with files on the memory card and keep print statistics. Commands that depend on a build option name it.
Stopping and checking
| Command | Parameters | Meaning |
|---|---|---|
M0, M1 | S seconds or P ms: how long to wait (S wins if both are given); any text: message for the display | After the last move, pause until the user continues. M1 is a deprecated alias. Ignored without a display controller or EMERGENCY_PARSER; with the parser, M108 continues |
M16 | The expected machine name (required) | With EXPECTED_PRINTER_CHECK: halt, needing a reset, unless the text matches MACHINE_NAME, case included |
M410 | None | Quickstop: halt all motors at once without deceleration, so positions are lost. Delayed unless EMERGENCY_PARSER is built in |
M876 | S number (required): the answer chosen | With HOST_PROMPT_SUPPORT: reply to a prompt shown by the host, such as purge more or continue after a filament runout |
Spindle, laser and coolant
M3 to M5 need SPINDLE_FEATURE or
LASER_FEATURE and wait for queued moves first.
| Command | Parameters | Meaning |
|---|---|---|
M3 | S power: in the configured unit, PWM 0–255 by default, else percent or RPM (CUTTER_POWER_UNIT); O 0–255: power as PWM; I: inline laser mode, where the S of each G1 to G5 sets the power and G0 moves are unpowered | Spindle clockwise, or laser on |
M4 | As M3 | Spindle counter-clockwise, or laser on |
M5 | None | Spindle or laser off; G0 and G28 also turn a laser off |
M7, M8, M9 | None | With COOLANT_CONTROL: mist on; flood coolant or air assist on; all off |
M10, M11 | None | Since 2.0.8, with AIR_EVACUATION: cutter vacuum or laser blower on, off, immediately |
M12 | S 0/1: value for the enable pin | Since 2.0.0, with EXTERNAL_CLOSED_LOOP_CONTROLLER: wait for queued moves, then optionally set the controller’s enable pin |
Motors, extruder mode and idle timers
| Command | Parameters | Meaning |
|---|---|---|
M17 | Axis letters X Y Z E A B C U V W | Power the named motors, or all |
M18, M84 | Axis letters as above; S seconds: set the idle timeout instead, 0 to disable it | Switch off the named motors, or all |
M82 | None | Extruder positions absolute, whatever the other axes do; G90 and G91 clear this |
M83 | None | Extruder positions relative, likewise |
M85 | S seconds | Longest time without moves before the firmware shuts everything down and halts |
M86 | S seconds: idle period; T temp: only acts above this extruder temperature; E temp: hot end temperature to fall back to; B temp: bed temperature to fall back to | Since 2.1.3, with HOTEND_IDLE_TIMEOUT: lower the heaters of an idle machine. Alone, reports. Stored in EEPROM |
M87 | None | Disable that timer, as M86 S0 |
M80 and M81: power supply
| Command | Meaning |
|---|---|
M80 | Switch the supply on; needs PSU_CONTROL, a PS_ON_PIN and a board powered separately |
M80 S | Only report the state: PS:1 on, PS:0 off |
M81 | In every build: finish queued moves, disable motors, switch off heaters and fans, stop the job timer, delete the power-loss recovery file and switch the supply off |
M81 Dseconds | With POWER_OFF_TIMER: switch off after this delay |
M81 S | With POWER_OFF_WAIT_FOR_COOLDOWN: switch off once hot ends, and chamber and cooler if configured, are below their limits. With D too, both conditions must be met |
Memory card files
These need SDSUPPORT and also serve a USB drive. File names in
listings are in the short DOS 8.3 form.
| Command | Parameters | Meaning |
|---|---|---|
M20 | L: add long names (since 2.0.9, LONG_FILENAME_HOST_SUPPORT); T: add timestamps (since 2.1.2, M20_TIMESTAMP_SUPPORT); F: BIN files only (since 2.0.9.4, CUSTOM_FIRMWARE_UPLOAD) | List printable files (.gcode, .gco, .g; no hidden files) with sizes, between Begin file list and End file list |
M21 | None | Mount the last selected card or drive |
M22 | None | Act as if the card had been removed |
M23 | File name (required) | Select a file |
M24 | With POWER_LOSS_RECOVERY: S byte: position to resume from; T time: time already elapsed | Start or resume the selected file, unparking the nozzle if it was parked |
M25 | None | Pause, parking the nozzle with PARK_HEAD_ON_PAUSE |
M26 | S byte | Set the next read position in the open file |
M27 | S seconds: report automatically at this interval, 0 off (AUTO_REPORT_SD_STATUS); C: report the open file’s names | Report progress as SD printing byte n/total or Not SD printing |
M28 | B1: binary transfer mode (BINARY_FILE_TRANSFER); file name (required) | Write all following commands to the file without running them |
M29 | None | Close a file opened by M28, or end M928 logging |
M30 | File name (required) | Delete a file |
M32 | P 0/1: 0 plain start (default), 1 subprogram, returning to the saved position afterwards; S byte: start offset; then ! and the path, last, closed with # when P is used | Select and start a file, also from within a file; documented as a little-used beta feature |
M33 | Short path (required) | Since 1.0.2, with LONG_FILENAME_HOST_SUPPORT: report the long form |
M34 | S order: -1 reverse alphabetical, 0 order of file IDs, 1 alphabetical, 2 deprecated alias for -1, empty the default; F -1, 0, 1: folders first, mixed, last | Since 1.1.0, with SDCARD_SORT_ALPHA: sorting in the display menus |
M524 | None | Since 2.0.0: abort the card print and turn off all heaters |
M928 | File name (required) | Log everything received to a file while the machine goes on working; end with M29 |
M23 /musicg~1/jingle.gco
M24
M32 S5022 !/boats/sailboat.gco
M32 P !/models/lgbust.gco#
Progress, job timer and recovery
| Command | Parameters | Meaning |
|---|---|---|
M31 | None | Report the time of the current job |
M73 | P percent: progress, overriding the file position until P0 (SET_PROGRESS_PERCENT); R minutes: remaining time (SET_REMAINING_TIME); C minutes: time to the next user action (SET_INTERACTION_TIME) | Set what the display shows (SET_PROGRESS_MANUALLY); R and C are not counted down. With M73_REPORT it also reports |
M75 | With DWIN_LCD_PROUI, a text for the screen heading | Start the job timer; Marlin takes a running timer to mean a job is in progress. PRINTJOB_TIMER_AUTOSTART also starts it when heating begins |
M76 | None | Pause the timer |
M77 | None | Stop the timer |
M78 | S78: reset all statistics (other values only report); R 1–3: reset that service interval countdown | With PRINTCOUNTER: report job statistics |
M413 | S 0/1; omitted, reports | Since 2.0.0, with POWER_LOSS_RECOVERY: save the job state to the card while printing so it can be resumed. Stored in EEPROM |
Repeats and macros
| Command | Parameters | Meaning |
|---|---|---|
M808 | L count: set a start marker; L or L0 loops without end; no parameter: count down and jump back | Since 2.0.8, with GCODE_REPEAT_MARKERS, card printing only; up to 10 nested markers by default |
M810–M819 | Commands separated by | | With GCODE_MACROS: with text, store one of ten macros; alone, run it |
M820 | None | Since 2.1.3: report the stored macros |
M808 L5
M118 Hello World
M808
M815 G0 X0 Y0|G0 Z10|M300 S440 P50
M815
Sources
- MarlinDocumentation – Marlin’s own documentation source: files M000-M001, M003 to M005, M007-M009, M010-M011, M012, M016 to M018, M020 to M034, M073, M075 to M078, M080 to M083, M085 to M087, M410, M413, M524, M808, M810-M819, M820, M876 and M928 in
docs/gcode/, anddocs/features/psu_control.md, as of 3 December 2026