This page gives the commands of Prusa-Firmware-Buddy, the firmware of Prusa
Research’s 32-bit printers, as dispatched and documented in the
master branch of its repository, read on 3 December 2026. The
8-bit i3 printers run a different firmware, covered on the
Prusa MK3 family page. Many commands
are compiled in only for some printer models or build options, so a given
printer answers a subset of what is listed here.
How a command is handled
The firmware has two dispatchers. Its own one is tried first. A command it
does not take is passed to the dispatcher of the bundled copy of Marlin,
and one that neither knows produces the unknown-command error. An
ok follows the command (M105 sends its own).
Where a code below behaves like Marlin’s but is not described further,
the Commands page and the Marlin
pages give the general form; the bundled copy is not the current Marlin and
may differ.
What is read from a file before printing
Before a print the firmware scans the file’s metadata and then its first
200 commands (M486 lines are not counted). A leading line
number is skipped.
| Line | What is taken from it |
|---|---|
M862.1 to M862.6 | Requirements on nozzle, printer model, firmware version, G-code level and features, compared with the printer (see print checks) |
M115 Uversion | A version newer than the running one is noted as available firmware |
M555 | The print area, from X Y and the sizes W H, used for bed preheating |
M140 S, M190 S | The bed preheat temperature |
M104 S, M109 S | The hotend preheat temperature: the highest value found |
; estimated printing time (normal mode) = … | The printing time shown |
; filament_type = …, ; extruder_colour = … | One item per tool, separated by semicolons |
; filament used [mm] = …, ; filament used [g] = … | One number per tool, separated by commas |
; total filament used for wipe tower [g] = …, ; total toolchanges = … | Read by builds with more than one extruder |
The metadata comments have the form ; name = value; binary
G-code files carry the same names and values without the semicolon. In a
text file, thumbnail comments in QOI form of the expected sizes are also
recognised.
Movement and coordinates
| Command | Meaning and parameters |
|---|---|
G0, G1 | Move to X Y Z E at F per minute (applied if above 0). Moves of a cancelled object are not made |
G2, G3 | Arc to X Y Z E at F: centre offsets I J or radius R; P number of full circles |
G4 | Dwell P ms or S s. It does not wait for queued moves to finish; use M400 for that |
G27 | Park. X Y Z position; P Z handling: 0 (default) raise to at least Z above the print, 1 absolute, 2 relative; W preset position: 0 park, 1 purge, 2 load, 3 tool park (X Y Z override it); R retraction in mm, V its speed in mm/s; A angle, so that Z moves together with XY |
G28 | Home X Y Z. I no precise refinement; L force levelling on or off afterwards; N leave motion settings unchanged; O only if the position is not known; Q like O only on printers that track the precision of homing, otherwise always home; P skip the print sheet check; R raise first; S simulated (development builds); D disallow homing self-calibration, C force it |
G90, G91 | Absolute, relative positioning |
G92 | Set the current position of X Y Z E |
G123 | Manual move to X Y Z E at the manual feed rate; stops when a new command is queued |
G750 | Move at the nozzle cleaner: X Y relative to its origin, in machine coordinates without mesh correction; E relative; F mm/min (default the parking speed); L adjust the speed for the filament (slower for flexible ones); A do not wait |
G21 | Accepted, does nothing (millimetres) |
Levelling, probing and calibration moves
| Command | Meaning and parameters |
|---|---|
G12 | Clean the nozzle. R make sure the filament is retracted first. With the simple cleaner, S is the cleaning temperature (default the current target) and C cools down on the touch point (default 1; C0 leaves at once). On INDX printers S selects a sequence: 0 clean (default), 1 quick, 2 deep, 20 clean after purge, 21 power-panic purge, 30 eject blob, 90 enter the cleaner, 91 leave it |
G26 | First layer calibration, no parameters. Uses the selected tool’s filament (with an MMU and no slot selected, slot 0); does nothing if no filament type is set or no tool is picked |
G29 | Unified Bed Leveling, with parameters in the next table. With the load-cell probe, G29 P9 cleans the nozzle by probing the rectangle X Y W H (a printer with a simple cleaner cleans there instead and needs no rectangle) |
G30 | Probe at X Y (default the current position); E engage the probe each time (default 1) |
G42 | Mesh point I (column), J (row); P move the probe there; F maximum feed rate, kept for later moves |
G80 | MK3 compatibility mesh levelling, no parameters, in builds with G-code compatibility; needs a picked tool. It sets the print area to 250 × 210 mm, moves to X32 Y-4 Z40, waits for a probing temperature (25 below the print target from 250 °C up, 170 °C above 170, otherwise the target), lowers to Z5, runs G29 P9 X0 Y-4 W32 H4, retracts 2 mm, releases the extruder motor, runs G29, raises to Z30, restores the print temperature and pushes the 2 mm back. In MK3 compatibility mode it ends with G1 Z0.15 |
G162 | Calibrate Z |
G163 | Measure the length of axis X or Y; S sensitivity, P measurement period |
G425 | (XL) Calibrate with the calibration object |
G426 | Contactless tool offset measurement: F, R first and second speed in mm/s (7, 15), Z sensing height, X Y sensor position (single-coil sensor), D scan diameter, I J scan lengths in X and Y that override D; defaults come from the configuration |
G427 | Full tool offset calibration of the mapped tools, saved to memory: R random XY jitter in mm (0 to 255) while probing Z, P probe repetitions (1 to 255, default 1) |
G29 parameter | Meaning |
|---|---|
A, D | Activate, disable |
P0 | Zero the mesh and turn it off |
P1 | Invalidate and probe automatically |
P2 | Probe unreachable points by hand (display); B shim mode, H lift between points. C uses the current location: P1 continue a partial mesh, P2 continue in order regardless of the nozzle position, P3 fill with a constant |
P3 | Fill empty points: with C a constant, R how many (negative for all); without C a smart fill |
P4 | Fine tune on the display; H offset above the mesh |
P5 | Mean and standard deviation; C corrects |
P6 | Shift the mesh by C |
P9 | Nozzle cleaning, as above |
E | Stow the probe after each point |
F | Fade height (10 mm if given without a value) |
I | Invalidate that many points near X Y (negative for all) |
J | Grid levelling with that many points per side (without a value, three points) |
L, S | Load, store the mesh, with a slot number; L makes the slot active, S-1 prints the mesh as G-code |
Q, R | Test pattern; repeat |
T | Print the map: 0 readable, 1 for a spreadsheet |
U | Probe the perimeter (G29 P1 T U) |
V | Verbosity 0 to 4 |
X, Y | Location |
K, Q-1, W | Only in builds with levelling debugging |
| Command | Meaning and parameters |
|---|---|
M420 | S 0 off, 1 on, 2 random mesh; Z fade height (0 off); V print the grid; L load mesh number (0); T format: 0 readable, 1 CSV, 2 display, 4 compact; C centre the mesh |
M421 | Set a mesh point: I J indices or C the one nearest the nozzle; Z value, Q amount to add, N mark undefined |
M401, M402 | Deploy, stow the probe |
M851 | Probe offset X Y Z |
M853 | (iX) Align Z over the bed pins; D detach mode (to the Z endstop); C motor current (300, or 900 in the other mode), F feed rate (homing). Home again afterwards |
M555 | Set the print area X Y W H |
M556 | Modular bed: bedlet at X Y or number I; A activate, D deactivate |
M557 | Modular bed gradient: C cutoff, E exponent, S expand to the sides |
Stopping, motors, files and time
| Command | Meaning and parameters |
|---|---|
M0 | Pause: stops the command queue until resumed with the knob. No parameters |
M1 | Handled by Marlin’s stop handler |
M17 | Enable motors X Y Z E |
M18, M84 | Disable motors X Y Z E; S idle timeout in s |
M20, M21, M22 | List, initialise, release storage |
M23 name, M32 name | Select a file; select and start |
M24, M25 | Start or resume, pause |
M26 | Set the file position S |
M27 | Report print status; C the current short file name |
M28, M29 | Begin, end writing a file (M29 is not written into it) |
M30 name | Delete a file |
M31 | Report the time since the print started (or since the last M109) |
M46 | Report the IP address; M also the MAC address |
M73 | Progress: P percent and R minutes left, Q and S the same for stealth mode; C minutes to the next pause, D for stealth mode; T pause time in the older form |
M74 | Set the mass on the bed, W grams |
M75, M76, M77 | Start, pause, stop the job timer |
M80, M81 | Power on, off, with a power switch; M80 S only reports the state |
M82, M83 | Absolute, relative extrusion |
M86 | Safety timer S s |
M108 | Cancel the wait for heating |
M110 | Set the line number N |
M112 | Emergency stop |
M400 | Wait for queued moves to finish |
M410 | Quick stop |
M486 | (not iX) Object cancelling: T object count and reset (1 without a value); S current object (-1: not part of an object, always printed); C cancel the current one, P cancel by index, U restore by index. A name (older form N) names an object: it must come straight after M486 and the whole rest of the line is the name, quotes removed; elsewhere on the line it causes the line to be ignored |
M601, M602 | Pause, resume the print |
M604 | Abort a serial print |
M876 | Host prompt answer S; E error popup (documented for the MINI) |
M997 | Firmware update: O reflash the same or an older version; S module (0 main; 1 to 4 reserved); B board address (unused); /name short name of a firmware file |
M999 | With R, reset the controller; otherwise Marlin’s restart after a stop |
Motion and machine settings
| Command | Meaning and parameters |
|---|---|
M92 | Steps per unit X Y Z E; T tool for E; H microsteps and L layer height belong to a feature not active by default |
M200 | Filament diameter D for volumetric extrusion (D0 linear), tool T |
M201, M203 | Maximum acceleration, maximum speed for X Y Z E; tool T |
M204 | Acceleration: S print and travel, P print, R retraction, T travel; F maximum filament acceleration during printing moves (0 off) |
M205 | B minimum segment time in µs, S minimum speed, T minimum travel speed, X Y Z E jerk; J in some builds only |
M206, M428 | Home offsets X Y Z; set them from the current position |
M211 | Software endstops S 1 on, 0 off |
M217 | Z raise at tool change (MMU on MK models, XL) |
M218 | Offset of tool T in X Y Z |
M220 | Speed percentage S; B back up, R restore (MMU) |
M221 | Flow percentage S, tool T |
M290 | Babystep X Y Z (S is the same as Z); R read; P leave the probe offset alone |
M301 | Hotend PID P I D for tool E (default 0), C in builds with extrusion scaling; reports the values |
M303 | Not supported: answers that it is not supported |
M304 | Bed PID P I D |
M500 to M503 | Store, read, reset to defaults, report settings |
M569 | Driver mode of X Y Z E: S 0 spreadCycle, 1 stealthChop |
M572 | Pressure advance: extruder D, S 0 to 1.0 s (0 off), W smoothing window 0 to 0.2 s (0.04) |
M593 | Input shaper: D damping 0 to 1; F frequency in Hz (0 off); T type: 0 ZV (default), 1 ZVD, 2 MZV, 3 EI, 4 two-hump EI, 5 three-hump EI; R vibration reduction above 0 (20); X Y Z axes; A frequency change with weight, M mass limit for it; W save |
M900 | Linear advance factor K, tool T |
M9200, M9201, M9202 | Reload input shaper settings; reset motion parameters; clear precise homing calibrations |
M9140, M9141, M9150 | Stealth mode off, status, on |
Motor drivers, resonance and phase stepping
| Command | Meaning and parameters |
|---|---|
M122 | Driver report for X Y Z E; S continuous reporting on or off, P its interval in ms, V raw registers |
M350 | Microstepping X Y Z E; S all, B extruder 1 |
M906 | Motor current in mA for X Y Z E; I 1 Z2, 2 Z3; T extruder. In builds with current profiles P picks one (0 defaults, 1 more extruder current, 2 less for flexible filament) and the other axis values are ignored. Alone: report |
M911, M912 | Report, clear (X Y Z E) the driver overtemperature prewarning |
M913 | Hybrid mode threshold X Y Z E; I 1 Z2, 2 Z3 |
M914 | StallGuard sensitivity X Y Z, I |
M919, M920 | Write, read a driver register (axis X Y Z E, register, and for writing the data) |
M958 | Vibrate X Y Z (start direction 1 or -1): F Hz, A acceleration, N periods, C calibrate the accelerometer’s sample rate, K report in Klipper’s style, I harmonic |
M959 | Tune the input shaper on X Y Z: K Klipper’s algorithm, KM a modified one; F start, G end, H step frequency; A acceleration, N periods, I harmonic; D do not home and centre first; W save |
M961 | Manual belt tuning by resonance |
M970 | (XL, iX, CORE One, CORE One L, as are M971 and M972) Phase stepping on X Y; alone: report |
M971 | Motor current correction table of X or Y, direction F forward or B backward: read; R reset; or set entry I (from 0) to magnitude M, phase P |
M972 | Calibrate the X or Y motor and apply the compensation found |
M973 | Internal. Correction sweep: phase from A to B radians, magnitude from C to D (-1 to 1), harmonic H (1 to 16); sends accelerometer samples |
M974 | Internal. Resonance during a speed sweep of X or Y (exactly one): from A to B revolutions per second over R revolutions (the sign gives the direction) |
M1959 | Input shaper wizard |
M1977 | Phase stepping calibration: D restore the default, U unattended |
Temperature, fans and chamber
| Command | Meaning and parameters |
|---|---|
M104 | Hotend target S, tool T; D temperature to display |
M104.1 | (XL) Early preheating of a tool: S or R temperature as in M109, D, F autotemp, T; P seconds until the tool is needed (standard mode), Q the same for stealth mode |
M105 | Report temperatures, tool T |
M109 | Set and wait: S waits while heating only, R while heating or cooling; C waits for a value without changing the target; D, F, T |
M106 | Fan speed S 0 to 255 (decimals rounded). P fan: 0 print, 1 heatbreak, from 2 other fans: 3 cooling or XL enclosure, 4 filtration, 5 bed, 6 dock (INDX), 7 processor (XLS), 8 modular bed cooling (XLS). R automatic control (beats S); T tool; N breakpoint and G slope of the ramp of chamber fans 3 and 4; A keep the current speed, or with P5 the maximum of the automatic bed fan; with P5, B bed and C chamber thresholds (the chamber is used if C is set and the chamber has a target; full speed above the threshold, linear below). Fans 7 and 8 stay automatic until S overrides; R or a restart restores that |
M107 | Fan off, P, T |
M113 | Interval of the host keep-alive messages, S s (0 off) |
M123 | Fan report; S automatic report interval in s |
M140 | Bed target S |
M141 | Chamber target S (0 for none) |
M142 | Heatbreak temperature S, tool T |
M147, M148 | Chamber filtration on, off, for the current print only (filtration must be enabled in the settings) |
M155 | Automatic temperature report every S s |
M190 | Bed temperature and wait: S heating only, R heating or cooling |
M191 | Chamber temperature and wait: S heating, R both, C cooling only |
M302 | Cold extrusion: minimum temperature S, P allow |
M870 | Chamber vents: O open, C close; no automatic retraction |
M1700 | Internal. Preheat menu: T tool (-1 all), W 0 to 3 (default 3), S filament, E enforce the temperature; B0, C0, H0 leave out bed, chamber, heatbreak |
Tool changes
| Command | Meaning and parameters |
|---|---|
Tn | Select tool n, counted from 0. On toolchangers: F feed rate; S no XY move afterwards; M use the tool mapping (default yes); L lift: 0 none, 1 by the greatest mesh difference, 2 full (default); D 0 do not return in Z, 1 normal |
Tn, T?, Tx, Tc | With an MMU: Tn needs a following extrusion (at least 38.10 mm at 19.02 mm/s) to bring the filament to the extruder wheels; T? loads to the wheels by itself; Tx is like T? without a preheated nozzle; Tc loads into the heated nozzle |
P0 | (XL, INDX) Park the tool: S no XY move afterwards; L and D as for T |
M863 | (MK with MMU, XL) Tool mapping: M Pphysical Llogical maps a tool used in the file to a physical one; E1, E0; R reset; alone: print |
M864 | Spool joining (MK3.5, MK3.9 and MK4 with MMU, XL): J An Bn continues with tool B when A runs out; R reset; alone: print |
M1984 | Park a stuck nozzle into dock T (INDX) |
Filament and the MMU
| Command | Meaning and parameters |
|---|---|
M403 | MMU filament behaviour for extruder E: F 0 default, 1 flexible, 2 PVA |
M591 | Stuck filament monitor (MK3.9, MK4, iX, XL): S on or off, P permanently, R restore (overrides S and P); I detections skipped before reporting and F milliseconds after which a skip is forgotten (set both together); alone: report |
M600 | Filament change: E retraction, X Y park position, Z lift, U unload length (negative), L load length, B beeps (-1 without end), T tool, A use a joined spool if set, otherwise change by hand, C colour (a number or "name"), S"filament" (does not set a temperature; the current target is used), N do not return, P T is a logical tool number |
M603 | Preset change lengths: T tool, U unload (negative), L load |
M701 | Load: T tool, Z minimum parking height, L length (0 purge only), S"filament", P MMU slot, O colour as an RGB number, W preheat dialogue: 255 none (default), 0 no return or cooldown, 1 offer cooldown, 2 offer return, 3 both; R resume if paused; G tag identifier hash (internal) |
M702 | Unload: T, Z, U unload retraction, W as above, I ask whether it succeeded |
M704, M705, M706 | (MK with MMU) Preload, eject, cut the filament of slot P |
M707 | Read an MMU register: A address in hexadecimal (A0x1b) |
M708 | Write an MMU register A with X, a 16-bit value (default 0) |
M709 | MMU control: S 0 or 1 power; X 0 soft reset, 1 reset pin, 2 power cycle, 42 erase its memory; alone: reports 0 or 1 |
M865 | Filament types. Select with S"name", I the one loaded in a tool, U a user filament, X a pending custom type (loaded later by name "#"); L mark as loaded in a tool; R reset. Set T nozzle, P preheat, B bed and H heatbreak temperatures, A abrasive, G flexible, C chamber target, D and E chamber minimum and maximum, F needs filtration, J"preset" base preset (empty for none), N"name", O"#hex" colour |
M865.1 | Identifiers: A material, B package, C instance, each a quoted UUID |
M1600 | Filament change outside a print: T tool, R preheat for return, U when the loaded type is unknown: 0 return (default), 1 ask only then, 2 always ask; S filament, O colour, P logical tool |
M1701 | Autoload, T, G |
M1702 | Cold pull |
M1704 | Test load of slot or tool P; M apply the tool mapping (default yes) |
M1705 | Automatic retraction; N do not park over the waste bin |
M1601 | Internal. Stuck filament detected, V tool |
Print checks
Each code reports the printer’s own value with Q; with
P in a file it states what the file needs, and is compared
before the print as described under
what is read.
| Command | Requirement |
|---|---|
M862.1 | Nozzle of tool T: P diameter, A hardened, F high flow |
M862.2 Pcode | Printer model by number: 120 MINI, 130 MK4, 160 iX, 170 XL, 210 MK3.9, 230 MK3.5, 260 MK4S, 270 MK3.9S, 280 MK3.5S; with MMU3, 30000 more (for example 30130) |
M862.3 P"name" | Printer model by name: MINI, MK3.5, MK3.5S, MK3.9, MK3.9S, MK4, MK4S (each also with the suffix MMU3), XL, iX. The model list is the one in the documentation comment and may be shorter than the code’s |
M862.4 Pversion | Oldest firmware: major.minor.patch, optionally + and a build number; anything after the build number is ignored |
M862.5 Plevel | G-code level; a level above the firmware’s fails |
M862.6 P"feature" | A required feature, compared without regard to case: Input Shaper, MMU3, INDX lock, HT Hotend, depending on the printer. Any other name fails the check |
Reports, host, lights, sound and expansion
| Command | Meaning and parameters |
|---|---|
M111 | Debug flags S |
M114 | Report the position |
M115 | Answers FIRMWARE_NAME:Prusa-Firmware-Buddy with the version, source address, protocol version, MACHINE_TYPE, EXTRUDER_COUNT and UUID, then Cap:name:0 or :1 lines for the capabilities, among them Z_PROBE, LEVELING_DATA, BUILD_PERCENT, PROMPT_SUPPORT and CHAMBER_TEMPERATURE |
M117 | Show the text on the display |
M118 | Send text to the host: A1 prefix // , E1 prefix echo:, P port (0 all, 1 to 9) |
M119 | Report the endstops |
M120, M121 | Enable, disable endstop checking |
M150 | LED colour R G B (0 to 255) or H (0 to 360) S V (0 to 100); A 0 solid, 1 pulsing, P period in ms; S doubles as the printer state: 0 idle, 1 printing, 2 pausing, 3 resuming, 4 aborting, 5 finishing, 6 warning, 7 power panic |
M151 | (XL, iX) Side lights: colour as above, D duration in ms (on iX 0 is without end), T fade in ms (the fade-in is part of the duration, the fade-out is not) |
M260 | I2C send: A address, B byte, S send the buffer, R reset it |
M261 | I2C read: A address, B bytes, S format: 0 characters, 1 hexadecimal, 2 signed 16-bit, 3 unsigned bytes in decimal |
M262 to M265 | I/O expander pin P (0 to 7): M262 direction B (0 output, 1 input), M263 read, M264 write B, M265 toggle |
M267, M268 | I/O expander register: write B to register R; read register R (0 input, 1 output, 2 polarity, 3 configuration) |
M300 | Beep: S Hz, P ms, V volume 0.0 to 1.0 |
M330 | Deprecated; accepted and ignored |
M331 metric, M332 metric, M333 | Enable, disable, list metrics |
M334 host port port | Metrics destination: address, metrics port, log port |
M340 address port | Log destination |
M1200 | Internal. Mark the printer ready (Prusa Connect) |
M1703 | Wi-Fi setup wizard: A as part of the initial setup, I only load the settings file |
Self-tests, calibration wizards and internal codes
| Command | Meaning and parameters |
|---|---|
M1978, M1987 | Fan self-test, heater self-test |
M1979 | Gearbox alignment |
M1980 | Door sensor calibration; O only ask about the emergency stop |
M1981 | Filament sensor calibration: T tool, F set of tools as bits |
M1982, M1983 | (INDX) Dock calibration, nozzle cleaner calibration |
M1985 | XY tool offsets against the sensor (Z is left to G427) |
M1986 | (INDX) Empty the waste bin |
M1988 | Gantry squareness; S silent |
M9933 | Internal. Once queued moves are done, mark the item given by C (cork) as reached |
M9934, M9944 | Internal. Change of several filaments (configuration in base64); G-code interrupt |
Marlin codes that are not available
The dispatcher source still names these, but they are compiled out or
marked as unused: G5, G17 to G19,
G34, G38, G800, M16,
M33, M34, M48, M202,
M355, M422, M425, M540,
M575, M800, M7219 and Marlin’s own
M997 (the firmware has its own, above). Its comments record
M7 to M9, M380, M381,
M852, G31 and G32 as removed.
The RepRap wiki also lists M42, M78,
M85, M125, M207 to M209,
M226, M250, M504 and
M928 under this firmware or others; neither dispatcher read
here has a case for them.
Not covered
The descriptions come mostly from the documentation comments of the
handlers, so the build conditions of each command, the exact reply texts,
the defaults and ranges not stated there, the behaviour of
M1 and M1979, and the rest of the file check are
not given here.
Sources
- src/marlin_stubs/gcode.cpp and the handlers beside it – the firmware’s own dispatcher and commands, GNU General Public Licence version 3; this page is written in our own words
- lib/Marlin/Marlin/src/gcode/gcode.cpp and the Marlin handlers – the bundled dispatcher and its handlers, GNU General Public Licence version 3
- src/common/gcode – the scan of a file before printing and the form of metadata comments, GNU General Public Licence version 3