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…
On this page
| Property | Value |
|---|---|
| Command | M204 |
| Function | Set acceleration |
| Firmware | Marlin and Klipper |
| Group | Settings |
| Syntax | M204 [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
| Parameter | Meaning |
|---|---|
P | Printing moves (mm/s²) |
R | Retract moves |
T | Travel moves |
S | Printing and travel together |
Example
M204 P1500 T3000 ; walls
M204 P3000 ; infillTips 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.
Related commands
- M201 — Max acceleration per axis
- M205 — Jerk and junction deviation
- SET_VELOCITY_LIMIT — Speed, acceleration and corner limits
More settings commands
| Command | Function | Firmware |
|---|---|---|
M500 | Save settings to EEPROM | Marlin |
M501 | Load settings from EEPROM | Marlin |
M502 | Factory reset (firmware defaults) | Marlin |
M503 | Report settings | Marlin |
M201 | Max acceleration per axis | Marlin |
M203 | Max feed rate per axis | Marlin |
M205 | Jerk and junction deviation | Marlin |
M906 | Stepper motor current (TMC) | Marlin |
SAVE_CONFIG | Save calibration to printer.cfg | Klipper |
SET_VELOCITY_LIMIT | Speed, acceleration and corner limits | Klipper |
FIRMWARE_RESTART | Restart (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