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
M400No parametersWait for the current planner queue to drain before continuing.
Practical examples
Beep after motion
G1 X100 F6000
M400
M300 S440 P100Prevents the beep command from being processed while the move is still queued.
Report after motion
M400
M114Requests the position only after earlier planned moves have finished.
Firmware context
| System | Status | What changes |
|---|---|---|
| Marlin | Common | Waits in a loop until the planner has completed all queued moves. |
| Klipper | Common | Supported as the standard wait-for-current-moves command. |
| RepRapFirmware | Common | Provides movement synchronization with firmware-specific scheduling details. |
| CNC controllers | Check dialect | Queue synchronization exists in controller-specific forms; M400 is not universal CNC syntax. |
What this viewer can show
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.