What M400 means

Firmware can accept several movement commands before the mechanism reaches their endpoints. M400 creates a synchronization point: later commands are not processed past it until earlier planned motion is complete. This matters before a beep, position report, motor release, photograph or other action that must occur after motion.

M400 differs from G4. A dwell waits for a requested duration, usually after earlier motion; M400 waits only as long as the remaining motion queue requires. If nothing is moving, it can complete immediately apart from normal processing overhead.

Syntax and parameters

M400
No parameters

Wait for the current planner queue to drain before continuing.

Practical examples

Beep after motion

G1 X100 F6000
M400
M300 S440 P100

Prevents the beep command from being processed while the move is still queued.

Report after motion

M400
M114

Requests the position only after earlier planned moves have finished.

Firmware context

SystemStatusWhat changes
MarlinCommonWaits in a loop until the planner has completed all queued moves.
KlipperCommonSupported as the standard wait-for-current-moves command.
RepRapFirmwareCommonProvides movement synchronization with firmware-specific scheduling details.
CNC controllersCheck dialectQueue synchronization exists in controller-specific forms; M400 is not universal CNC syntax.

What this viewer can show

Synchronization point recognized

The viewer already processes moves in source order, so M400 does not change geometry. It preserves the command but cannot reproduce controller buffering or host latency.

Common mistakes

  • M400 is not an emergency stop and does not cancel queued movement.
  • It does not add a guaranteed pause after motion; combine with G4 only when a fixed delay is required.
  • Waiting for commanded motion does not verify that the machine reached the position without lost steps.

Primary sources

This page is an original explanation, reviewed against the firmware documentation below. Always confirm commands against the firmware and configuration on the machine that will execute them.