What is a G04 Code? [With Lots of Examples]

The information below is meant for beginners. If you are experienced with CNC programming, then you probably already know this stuff and much more. If you are new to CNC programming, this is the place for you.

Please note that some of the topics below could include more information on the subject. However, in the interest of keeping things simple for those just starting out, they have been left out of this G code guide.

Ready to learn? Let’s go.






The machine will stop moving for a set amount of time

A G04 code makes the cutting tool stop moving for specified amount of time. Following that amount of time the machine will proceed to 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.

What to think about when 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

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?

Still, these differences should help you troubleshoot any program issues you have related to a G04 dwell code. Check out the examples below to get a better understanding of how you might see dwell codes on your machine.

I am not experienced enough with all brands of CNC machines. I would like to add a list here that tells the most common ways to callout a G04 command based on the CNC manufacturer.  If anyone has experience with a variety of machines, please leave a comment below and I will make sure to add the info to the post.

4 G04 code examples and descriptions of what they do

Example #1

N005 G04 P3

This is line number 5 of the program.

G04 sets the movement mode as dwell

P3 is the amount of dwell time = 3 seconds.

Example #2

N040 G04 F5.0

This is line number 40 of the program.

G04 sets the movement mode as dwell

F5.0 is the amount of dwell time = 5 seconds.

Example #3

N040 G04 F5

This is the same line as above, on the same controller. The decimal changes how the machine reads the code.

This is line number 040 of the program.

G04 sets the movement mode as dwell

F5 is the amount of dwell time. In this case, 5 milliseconds = .005 seconds.

A big difference. Watch those decimals.

Example #4

N100 G04 U5

This is line number 100 of the program.

G04 sets the movement mode as dwell

U5 is the amount of dwell time = 5 second.

CNC codes that are similar to G04

The table below lists all of the other G codes that control movement like a G04 code does.

Leave a Comment