Back to GSM Code List

G04: timed dwell

G04 stops axis motion for the time you tell it and then carries on with the next block, without stopping the spindle or the coolant. You use it so the tool turns once or twice at the bottom of a groove or a countersink and leaves a clean surface, to give the spindle time to come up to speed or the coolant time to arrive, and to keep two moves from being blended together. It is not modal: it only affects the block it is written in.

For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.

Family
Program control
Machine
Milling, Turning, Mill-turn
Risk
Low
Example
G04 P1000

Syntax by control

Fanuc (milling and turning)

G04 P1000

P with no decimal point is read in milliseconds: P1000 is a one second dwell. If you prefer seconds with decimals, you write it with X (or with U on a lathe): G04 X1.0 is the same as G04 P1000.

Haas

G04 P1.0

On Haas P is read in seconds and takes decimals, so P1.0 is one second and a P1000 copied out of a Fanuc program would be a thousand seconds of machine standing still. It is the difference that catches people out most when moving programs between controls: check it in your machine manual before you trust it.

Siemens 840D / 828D

G4 F2.5

On Siemens the time goes in F and in seconds, and the G4 block has to stand alone. With S you ask for the dwell in spindle revolutions (G4 S2 is two revolutions), which is more useful than time when what you want is one full turn of the edge at the bottom.

Heidenhain TNC (Klartext)

FUNCTION DWELL TIME1.5

On modern TNCs the wait is programmed with FUNCTION DWELL and the time in seconds. In old programs it shows up as CYCL DEF 9.0 TIEMPO DE ESPERA, with the value on line 9.1.

Address letters used with it

LetterWhat it setsUnit
PDwell time. It is the usual letter, and also the one that changes units between controls: milliseconds with no decimals on Fanuc, seconds with decimals on Haas.ms or s depending on the control
X / UDwell time in seconds with decimals on Fanuc (X1.5). On a lathe U is used for the same thing, because X is an axis coordinate.s
FDwell time on Siemens, in seconds. Here F has nothing to do with feedrate: inside a G4 block it changes meaning.s
SDwell measured in spindle revolutions on Siemens (G4 S2). It is the honest way to ask for the wait, because what cleans the bottom up is revolutions, not seconds.spindle revolutions

Worked example

Grooving a 3 mm wide recess in a 40 mm steel shaft on the lathe, down to a 30 mm diameter. The insert feeds all the way in, is left turning for a moment so the bottom comes out round and without the spiral step you get when you pull straight out, and then retracts. G97 keeps the rpm fixed, which matters in grooving because constant surface speed would run the rpm up as the diameter drops.

O0104 (GOLA CON PAUSA EN EL FONDO)
( Program header. )
G21 G18 G40
( Millimeters, XZ plane (the lathe plane) and no tool nose radius compensation. )
T0303
( The 3 mm grooving tool with its offset, number 3. )
G97 S900 M03
( Direct rpm, 900 rev/min, and spindle on. Nine turns a second: that is the number the dwell is worked out from. )
G00 X42. Z-20. M08
( Rapid approach to 42 mm diameter, two millimeters clear of the part, and at the axial position of the groove. )
G95
( Feed per revolution, which is how grooving insert tables are written. )
G01 X30. F0.08
( Feeds in to the groove diameter, at eight hundredths of a millimeter per revolution. )
G04 P500
( A half second dwell on a Fanuc control, where P is in milliseconds. At 900 rpm that is about seven turns of the part: plenty for the insert to clean the bottom. On a Haas, this same value would be 500 seconds. )
G00 X42.
( Comes out of the groove in rapid, with the recess finished. )
G00 X200. Z100. M09
( Retract to the change position and coolant off. )
M05
( Spindle stop. )
M30
( End of program. )
Open the simulator to check the example

Practical keys to using G04 in the workshop

What a dwell is really for

Four things, and all four come from the shop floor. The first is cleaning up a bottom: when a tool reaches the bottom of a groove, a countersink or a hole and retracts straight away, it leaves a spiral mark because it keeps feeding as it comes out; one or two turns of dwell wipe that out. The second is giving time to something the program does not control: the spindle coming up to speed, the coolant arriving, a tailstock or an ejector finishing its move. The third is separating blocks so the control does not blend them. And the fourth, in boring, letting the edge come off the wall before reversing.

How long the dwell should be

A useful dwell is measured in spindle revolutions, not in seconds: one or two turns is plenty, and the arithmetic is direct, 60 divided by the rpm times the number of turns. At 900 rpm, two turns is 0.13 seconds; at 3000 rpm, 0.04. Putting a full second in just in case is expensive for two reasons: in production, one second per hole across five hundred holes is over eight minutes given away, and at the bottom of the cut a long dwell means the edge is rubbing instead of cutting, heating up and burnishing the surface, which in stainless work hardens it and finishes off the insert.

What G04 does not fix

It is not a stop: the axes hold still, but the program carries on by itself when the time is up, so it is no substitute for M00 or M01 when somebody has to step in. It does not guarantee the spindle has reached speed either: that is handled by the spindle at speed signal the control checks on its own, and a fixed dwell is a workaround that stops being valid the moment the rpm change. And on machines with block lookahead, dropping a G04 into the middle of a finishing pass forces an exact stop and can leave a visible mark on the surface.

Mistakes that cost you a part (or a tool)

  • Moving a program from Fanuc to Haas without reviewing the P: where there used to be a one second dwell you can end up with a thousand second one, with the tool rubbing the bottom the whole time.
  • Writing P with decimals on a control that expects whole milliseconds: depending on the model you get a format alarm or a rounding you did not expect.
  • Putting the G04 in the same block as a move: most controls want the block on its own, and if not, the dwell runs before or after what you intended.
  • Leaving the value out: a G04 with no P, X or F runs as a zero dwell or alarms, depending on the control.
  • Dwelling with the tool loaded against the material in stainless or titanium: the edge rubs, work hardens the surface and the next pass runs against a hard skin.
  • Spreading one second dwells across the bottom of every hole in a long run: cycle time goes through the roof with no measurable improvement.
  • Using a dwell to wait for the spindle and then changing the rpm without reworking it.

Frequently Asked Questions (FAQ)

Is G04 P1000 one second or a thousand seconds?

It depends on the control. On Fanuc, P is in milliseconds and P1000 is one second. On Haas, P is read in seconds, so that same block would be an enormously long dwell. It is the first thing to check when you take a program from one machine to another.

Does G04 stop the spindle?

No. G04 holds axis motion only; the spindle keeps turning and the coolant keeps running. That is exactly why it works for cleaning up the bottom of a groove: the tool goes on cutting in place without feeding.

How much dwell do I need at the bottom of a hole?

One or two spindle revolutions. The arithmetic is 60 divided by the rpm, times the turns you want: at 1200 rpm, two turns is a tenth of a second. In canned cycles this is already catered for and you program it with the P of G82, with no separate G04 needed.

What is the difference between G04 and M00?

G04 waits a set time and carries on by itself; M00 stops the program and nothing moves until somebody presses cycle start. If what you want is to measure the part, blow chips off or look at something, the right instruction is M00 or M01, never a long dwell.

Can you dwell in revolutions instead of time?

On Siemens yes, with G4 S followed by the number of revolutions. On Fanuc and Haas the dwell is always a time, so you do the conversion yourself from the active rpm. That means reviewing the dwell every time the cutting speed changes.

Related codes

Related tools