3D printer G-code · Marlin and Klipper

M204: Set acceleration (Marlin & Klipper)

Set acceleration — Sets the acceleration for printing (P), retraction (R) and travel (T). Slicers write M204 per feature to print outer walls softly and infill hard. Klipper accepts M204…

By cnccode · Updated
On this page
  1. What does M204 do?
  2. Parameters
  3. Example
  4. Tips from practice
  5. Related commands
  6. More settings commands
  7. Frequently asked questions
PropertyValue
CommandM204
FunctionSet acceleration
FirmwareMarlin and Klipper
GroupSettings
SyntaxM204 [P<print>] [R<retract>] [T<travel>] or M204 S<accel>

What does M204 do?

Sets the acceleration for printing (P), retraction (R) and travel (T). Slicers write M204 per feature to print outer walls softly and infill hard. Klipper accepts M204 S and uses the smaller of P and T if both are given.

Parameters

ParameterMeaning
PPrinting moves (mm/s²)
RRetract moves
TTravel moves
SPrinting and travel together

Example

G-code
M204 P1500 T3000 ; walls
M204 P3000      ; infill

Tips from practice

  • The 3D printer simulator reads M204 from the file, so the time follows the slicer settings.

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 settings commands

CommandFunctionFirmware
M500Save settings to EEPROMMarlin
M501Load settings from EEPROMMarlin
M502Factory reset (firmware defaults)Marlin
M503Report settingsMarlin
M201Max acceleration per axisMarlin
M203Max feed rate per axisMarlin
M205Jerk and junction deviationMarlin
M906Stepper motor current (TMC)Marlin
SAVE_CONFIGSave calibration to printer.cfgKlipper
SET_VELOCITY_LIMITSpeed, acceleration and corner limitsKlipper
FIRMWARE_RESTARTRestart (RESTART / FIRMWARE_RESTART)Klipper

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 M204 do on a 3D printer?
M204 is set acceleration. Sets the acceleration for printing (P), retraction (R) and travel (T). Slicers write M204 per feature to print outer walls softly and infill hard. Klipper accepts M204 S and uses the smaller of P and T if both are given.
Does M204 work in Klipper and Marlin?
Yes, both firmwares understand M204.
Was this page helpful?