Temperature commands come in two kinds: those that set a target and carry on, and
those that hold back the following commands until it is reached. A waiting command
can keep a host from being heard; with EMERGENCY_PARSER built in,
M108 ends the wait. Temperatures are in degrees Celsius unless
M149 changes the unit.
M104 and M109: hot end temperature
M104 sets the target and continues. M109 also
waits.
| Parameter | Meaning |
|---|---|
S temp | Target; M109 S waits only while heating. With AUTOTEMP also the lowest automatic temperature |
R temp | M109 only: target, waiting whether heating or cooling |
T index | Hot end; the active one if omitted |
I index | Since 2.0.6: material preset, overriding S |
B temp | With AUTOTEMP: highest automatic temperature |
F factor | With AUTOTEMP: automatic temperature factor, by default AUTOTEMP_FACTOR_P; with AUTOTEMP_PROPORTIONAL, F0 switches it off |
M104 T1 S205 ; heat the second hot end, do not wait
M109 R120 ; wait until it is at 120, from above or below
M104 F S180 B190 ; automatic temperature between 180 and 190
The documentation shows M104 or M109 without parameters
switching automatic temperature off. With PRINTJOB_TIMER_AUTOSTART,
M109 starts the job timer when heating, and either command stops it
for a target at or below half of EXTRUDE_MINTEMP.
Bed, chamber, cooler and probe
| Command | Parameters | Meaning |
|---|---|---|
M140 | S temp; I index: material preset, overriding S (since 2.0.6) | Set the bed target and continue |
M190 | S temp: wait while heating; R temp: wait either way; I index: preset; T seconds: time over which to cool to the target (since 2.1.3, BED_ANNEALING_GCODE) | Set the bed target and wait; without parameters does nothing |
M141 | S temp | Set the heated chamber target and continue |
M191 | S temp: wait while heating; R temp: wait either way | Set the chamber target and wait |
M143 | S temp; S0 switches the cooler off | Since 2.0.8: set the laser coolant target and continue; capped at COOLER_MAXTEMP |
M193 | S temp | Set the coolant target and wait until the temperature is at or below it |
M192 | R temp: wait to reach it, heating or cooling; S temp: minimum, no wait if already higher | Since 2.0.6.2, with PROBE_TEMP_COMPENSATION: wait for the probe’s temperature sensor |
M108 | None | Break out of a temperature wait, or continue after M0. Ending a heating wait early may lead to cold extrusion messages |
M190 R70 T600 ; cool the bed slowly to 70 over 10 minutes
The cooler commands need LASER_FEATURE, a cooler temperature sensor
and the cooler pins.
Reports, presets and units
| Command | Parameters | Meaning |
|---|---|---|
M105 | T index: hot end; R: include the redundant sensor | Send a temperature report now |
M155 | S seconds; S0 stops | With AUTO_REPORT_TEMPERATURES: report at this interval |
M145 | S index: material; H temp: hot end; B temp: bed; F speed: fan | Set a preheating preset of the display menu; alone, report them. Needs a display; stored in EEPROM |
M149 | C, F or K | With TEMPERATURE_UNITS_SUPPORT: Celsius (default), Fahrenheit or Kelvin; alone, report the unit |
Fans
| Command | Parameters | Meaning |
|---|---|---|
M106 | S 0–255: speed, full if omitted; P index: fan, the print cooling fan if omitted; I index: material preset, overriding S (since 2.0.6); T value: secondary speed (since 1.1.7, EXTRA_FAN_SPEED): 3–255 sets it, 2 saves the current speed and switches to it, 1 restores | Set a fan. Takes effect after the moves already queued; immediately on an idle machine under manual control |
M107 | P index | Fan off |
M123 | S seconds: report automatically, 0 stops (AUTO_REPORT_FANS) | Report speeds, in revolutions per minute, of fans with tachometers |
M710 | S speed: while motors run; I speed: while they are off; A 0/1: automatic, otherwise always the idle speed; D seconds: keep the high speed after the motors stop; R: reset to defaults | Since 2.0.5.2, with CONTROLLER_FAN_EDITABLE: settings of the electronics fan; alone, report. Stored in EEPROM |
With LASER_SYNCHRONOUS_M106_M107 the first two commands switch the
laser instead.
M301, M304 and M309: PID values
These set the control loop of a hot end (M301, needs
PIDTEMP), the bed (M304, PIDTEMPBED) or the
chamber (M309, since 2.0.8, PIDTEMPCHAMBER). They are
reported by M503 and saved with M500.
| Parameter | Meaning |
|---|---|
P, I, D | Proportional, integral and derivative values |
E index | M301: extruder, default 0 |
C, L | M301 with PID_EXTRUSION_SCALING: C term and queue length |
F | M301 with PID_FAN_SCALING: F term |
M301 P21.01 I1.73 D63.67
M303: PID autotune
Heats and cools repeatedly to find PID values for a hot end or the bed.
| Parameter | Meaning |
|---|---|
E index | Hot end, default 0; -1 for the bed |
C count | Cycles, at least 3; default 5 |
S temp | Target temperature |
U 0/1 | Use the result, instead of only printing it |
D | With PID_DEBUG: only toggle debug output |
M303 E-1 C8 S60 ; bed, 8 cycles at 60
M303 E0 C6 S210 U1 ; hot end, and apply the result
M306: model predictive control
Since 2.0.9.4; needs MPCTEMP. Sets the values of the thermal model
that replaces PID for a hot end. Alone, reports them; save with
M500.
| Parameter | Meaning |
|---|---|
E index | Extruder; the active one if omitted |
P watts | Heater power |
C J/K | Heat capacity of the heater block |
R value | Sensor responsiveness: transfer coefficient divided by heat capacity |
A value | Heat transfer to the surroundings with the fan off |
F value | The same with the fan full on |
H J/K/mm | Heat capacity of the filament per millimetre |
T | With MPC_AUTOTUNE: tune the extruder; the hot end moves to 1 mm above the bed, so both should be clean |
S 0–2 | Since 2.1.3, with T: method, 0 automatic (default), 1 differential, 2 asymptotic |
M306 P40 ; a 40 W heater
M306 T S1 ; differential autotune
M302 and M305: cold extrusion and custom thermistor
| Command | Parameters | Meaning |
|---|---|---|
M302 | S temp: lowest temperature at which the extruder may move, S0 allowing it always; P 0/1: 1 allows cold extrusion, 0 enforces the check | With PREVENT_COLD_EXTRUSION; alone, report the state. M302 S170 P1 sets 170 but leaves the check off |
M305 | P index: thermistor table; R ohms: pull-up resistor; T ohms: resistance at 25 °C; B value: beta; C value: Steinhart–Hart C coefficient | Set or report the data of a user-defined thermistor (sensor type 1000). Stored in EEPROM |
M305 P0 R4700 T100000 B3950 C0.0
Sources
- MarlinDocumentation – Marlin’s own documentation source, files M104 to M109, M123, M140, M141, M143, M145, M149, M155, M190 to M193, M301 to M306, M309 and M710 in
docs/gcode/, as of 3 December 2026