3D printer G-code · Marlin and Klipper

M104: Set hotend temperature (no wait) (Marlin & Klipper)

Set hotend temperature (no wait) — Sets the target temperature of the hotend and continues at once. Used to start heating the nozzle while the bed heats, or to change the temperature between layers. S0…

By cnccode · Updated
On this page
  1. What does M104 do?
  2. Parameters
  3. Example
  4. Tips from practice
  5. Related commands
  6. More temperature commands
  7. Frequently asked questions
PropertyValue
CommandM104
FunctionSet hotend temperature (no wait)
FirmwareMarlin and Klipper
GroupTemperature
SyntaxM104 S<°C> [T<tool>]

What does M104 do?

Sets the target temperature of the hotend and continues at once. Used to start heating the nozzle while the bed heats, or to change the temperature between layers. S0 turns the heater off.

Parameters

ParameterMeaning
STarget temperature in °C
TExtruder number on multi-extruder printers

Example

G-code
M140 S60   ; bed, no wait
M104 S150  ; nozzle to 150 for probing, no ooze
M190 S60   ; wait for bed
M109 S210  ; wait for nozzle

Tips from practice

  • M104 alone never waits: a print can start with a cold nozzle if no M109 follows.
  • Heating the nozzle only to 150 °C during bed heating and probing stops oozing.

The command works in Marlin and Klipper. Options can differ: Klipper accepts fewer parameters for some M-codes and ignores codes it does not know with an "Unknown command" error.

More temperature commands

CommandFunctionFirmware
M109Set hotend temperature and waitMarlin and Klipper
M140Set bed temperature (no wait)Marlin and Klipper
M190Set bed temperature and waitMarlin and Klipper
M141Set chamber temperatureMarlin
M303PID autotuneMarlin
M301Set hotend PID valuesMarlin
M304Set bed PID valuesMarlin
PID_CALIBRATEPID tuning (Klipper)Klipper
TEMPERATURE_WAITWait for a temperature rangeKlipper
SET_HEATER_TEMPERATURESet a heaterKlipper

Test it before you print

Paste your start code or a whole file into the 3D printer simulator. It plans every move, shows the time and finds missing waits, cold extrusion and moves outside the bed.

Open the simulator

Frequently asked questions

What does M104 do on a 3D printer?
M104 is set hotend temperature (no wait). Sets the target temperature of the hotend and continues at once. Used to start heating the nozzle while the bed heats, or to change the temperature between layers. S0 turns the heater off.
Does M104 work in Klipper and Marlin?
Yes, both firmwares understand M104.
Was this page helpful?