G54.APP

G-code deep dive

G4 Dwell: Pausing a CNC Program the Right Way

G4G04P

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.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4Notes
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

Common mistakes

Frequently asked questions

How long does G4 P1 pause?

It depends on the control — that's the trap. LinuxCNC and GRBL read P as seconds: 1 second. FANUC reads P as milliseconds: 0.001 s. Mach3/Mach4 split it: a decimal P (P1.) is seconds, an integer P is milliseconds — configurable, worse. Always check the target control's convention.

Is G4 the same as G04?

Yes — leading zeros in G/M numbers are insignificant. G04 P500 and G4 P500 are the same block.

When do I actually need a dwell?

Spindle spin-up before entering material (mainly on controls that don't wait, like GRBL), letting a spot-drill or counterbore finish a clean bottom (that's what G82's built-in dwell is for), waiting for coolant to reach the tool, and giving a probe or air blast time to settle. Anything longer than a few seconds is usually better as an M0 stop.

Does G4 stop the spindle?

No. Only axis motion pauses — spindle, coolant, and all modal state carry on. That's the point: the tool keeps spinning at the bottom of a counterbore during a G82-style dwell to clean up the floor.

See it, don't guess it

Paste a program into the free G54.APP viewer and watch these codes execute — toolpaths, stock removal, and machine state, live in your browser. Nothing is uploaded.

Open the G-code viewer