What G4 means

A dwell adds time without requesting a new path. It is useful when a process needs to settle—for example, after activating a device or before taking a measurement. In Marlin, the command waits for earlier planned motion and then holds for the requested duration.

P and S are not interchangeable numbers: G4 P500 is half a second in common printer firmware, while G4 S5 is five seconds. CNC dialects also use G4, but the time word and units are controller-specific, so portable files should state their target controller clearly.

Syntax and parameters

G4 P<time-ms>
G4 S<time-seconds>
P

Dwell duration in milliseconds on Marlin and Klipper-style printer G-code.

S

Dwell duration in seconds on Marlin; support and precedence vary by controller.

Practical examples

Pause for half a second

G4 P500

Adds a 500 ms dwell after earlier planned motion has completed.

Pause for five seconds

G4 S5

Marlin interprets S as seconds. Confirm this form before using it on another controller.

Firmware context

SystemStatusWhat changes
MarlinCommonSupports P milliseconds and S seconds; S takes precedence when both are present.
KlipperCommonDocuments G4 P with a duration in milliseconds.
RepRapFirmwareCommonSupports dwell, with details documented in the firmware G-code dictionary.
CNC controllersCheck dialectG4 is common, but P interpretation can be seconds or controller-defined units.

What this viewer can show

Included in the timeline

The viewer adds supported G4 dwell time to its measured duration and preserves the source event, but it cannot model an external process settling during the pause.

Common mistakes

  • Do not read P500 as 500 seconds in printer G-code; on Marlin and Klipper it means 500 milliseconds.
  • A dwell blocks progress but does not cool, heat or move anything by itself.
  • An offline viewer can count the requested delay, not firmware scheduling overhead or host communication latency.

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.