G4 holds axis motion for a fixed time while everything else — spindle,
coolant, modal state — keeps running. It's a non-modal, one-shot command:
one block, one pause, done.
S12000 M3
G4 P2 ; wait 2 s for spin-up (LinuxCNC/GRBL: P in SECONDS)
G0 X0 Y0 Z5
G1 Z-3 F200
#The P word trap
The single thing to know about G4 is that the unit of P changes per control, and getting it wrong multiplies your pause by 1000:
| Control | P means |
G4 P500 pauses |
|---|---|---|
| LinuxCNC | seconds | 8 minutes 20 s |
| GRBL | seconds | 8 minutes 20 s |
| FANUC | milliseconds | 0.5 s |
| Centroid | seconds | 8 minutes 20 s |
| Mach3 / Mach4 | decimal P = seconds, integer P = ms (configurable) | 0.5 s (default) |
A FANUC-style G4 P500 pasted into a GRBL file turns a half-second chip
break into a coffee break; the reverse turns a deliberate 2-second
spin-up into 2 ms of nothing. FANUC also accepts X or U with a
decimal for seconds (G4 X1.5), and lathes can dwell in spindle
revolutions — check the specific manual when it matters.
When porting between controls, dwell lines are one of the places a find-and-check pass is mandatory — they're short, rare, and silently wrong.
| Operation | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|
| Dwell (pause) | G4 |
G4 |
G4 |
G4 |
G4 |
G4 |
Mach3/4: decimal P = seconds, integer P = milliseconds. |
— means the control has no equivalent code. Full cross-control tables: the complete G-code & M-code reference.
#Legitimate dwells
- Spindle spin-up where the control doesn't wait for at-speed (GRBL
posts insert one automatically after
M3). - Bottom of a hole: a revolution or two at depth cleans up a
counterbore floor — though
G82builds exactly this into the drilling cycle, which is the better spelling. - Process settling: coolant reaching the cut, an air blast clearing a pocket, a mister priming.
- Corner sharpening on controls without exact-stop: a tiny dwell lets
the machine catch up before direction reverses. (Modern path-blending
controls have better tools —
G61/G64.)
#Common mistakes
- Wrong unit for the target control. The whole table above. It's the most common porting bug after unit mode itself.
- Dwelling instead of stopping. A 30-second dwell "to check the part"
is a race against the program. Inspection holds are what
M0/M1are for — they wait for you. - Dwells as a chatter fix. If a cut needs pauses to survive, the feeds/speeds are the problem; the dwell just spreads the damage out.
- Expecting G4 to hold spindle state changes.
M5 G4 P1 M3does not guarantee a stopped-then-restarted spindle reaches speed — the dwell runs concurrently with the spindle's own ramp on some controls. Pair state changes with the next dwell, not the same block.