3D printer G-code · Marlin and Klipper

M400: Finish moves (Marlin & Klipper)

Finish moves — Waits until all moves in the buffer are done. Needed before commands that should happen at an exact moment, such as a beep, a photo for a timelapse or switching a relay.

By cnccode · Updated
On this page
  1. What does M400 do?
  2. Example
  3. Related commands
  4. More print control commands
  5. Frequently asked questions
PropertyValue
CommandM400
FunctionFinish moves
FirmwareMarlin and Klipper
GroupPrint control
SyntaxM400

What does M400 do?

Waits until all moves in the buffer are done. Needed before commands that should happen at an exact moment, such as a beep, a photo for a timelapse or switching a relay.

Example

G-code
G1 X0 Y200 F6000
M400
M300 S440 P200 ; beep when parked

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 print control commands

CommandFunctionFirmware
M220Speed factorMarlin and Klipper
M600Filament changeMarlin
M412Filament runout sensorMarlin
M413Power-loss recoveryMarlin
M84Disable motors (M84 / M18)Marlin and Klipper
M112Emergency stopMarlin and Klipper
M25Pause SD print (M25 / M24)Marlin
EXCLUDE_OBJECTCancel one objectKlipper
PAUSEPause, resume, cancelKlipper

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 M400 do on a 3D printer?
M400 is finish moves. Waits until all moves in the buffer are done. Needed before commands that should happen at an exact moment, such as a beep, a photo for a timelapse or switching a relay.
Does M400 work in Klipper and Marlin?
Yes, both firmwares understand M400.
Was this page helpful?