Quick Guide to the G04 CNC G Code [Dwell]

a graphic of a cnc machine with text that says learn g code today G04 dwell

The G04 code tells the CNC machine to stay in place for specified amount of time.

It’s a code that tells the machine to pause for a bit.

After the specified amount of time is done, the machine will proceed to read the next line of code.

When to use a G04 code?

G04 codes are used for multiple reasons.

They are used on lathes specifically, to break the chips. This way you don’t end up with one super long, razor-sharp chip.

They are also used to improve surface finishes on both lathes and mills. Dwelling at the bottom of a hole for instance may create a better finish on the bottom of the hole.

Another main reason that the G04 dwell code is used is to allow the machine time to perform an action. CNC machines tend to be very fast but sometimes all of their function can’t keep up. 

Sometimes you may need to tell your machine to pause so the coolant can get flowing enough or allow the machine enough time to finish a pallet change.

G04 vs G4

Some people get confused about whether the 0 is required to be included in a G04 code.

To clear this up, there is no need to include the extra zero in the code. The CNC machine will read the code the same. It really is just a matter of preference.

Often you will see the full G04 code used in textbooks or other reference materials. In practice though, many prefer the shortened G4 code in their programs.

If you are working on your own, then go with whichever format you prefer. If you work in a bigger shop, make sure to stick to the format that the business has been using.

Format for using a G04 code

There is some variation to how G04 codes are called out. The difference is how the dwell times are listed.

Depending on what brand/controller your machine is, the following can change:

  • Letter used in callout to list time. Common letters are F, P, U, and X.
  • Seconds vs milliseconds. 1 second = 1000 milliseconds. Some machines work in seconds, others work in milliseconds.
  • Decimal or no decimal. Some controllers require a decimal. Some don’t allow a decimal. Some allow either way, but treat the number different based on whether you use the decimal or not.

Real standardized stuff ain’t it?

For example, these three lines below could all do the same thing:

G04 P3

G04 U3.0

G04 U3000

Still, these differences should help you troubleshoot any program issues you have related to a G04 dwell code. 

Consult your machine manual to make sure you know how your individual machine handles dwell commands.

CNC codes that are similar to G04

If G04 pauses the CNC machine, what other codes are somewhat similar?

First you have stops.

Both of these codes pause the machine, but unlike G04 they also turn off machine function such as the spindle and coolant flow.

There are also some canned cycles that have dwell times baked into the code. These include:

Leave a Comment