G04 CNC Code Explained: An Easy Intro for Beginners [Dwell]

Welcome to our comprehensive guide to using the G04 CNC code. Whether you’re a beginner learning CNC programming or an experienced machinist, understanding the G04 CNC code is extremely important.

In this guide, we’ll break down everything you need to know about this dwell command, including how, when, and why to use it.

What does a G04 code do?

The G04 code tells the CNC machine to dwell (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.

Learn CNC Programming – It’s Easier Than You Think!

Learning G Code doesn’t have to be difficult…

If you know what to focus on.

Join our simple, easy-to-follow course, “G Code Made Easy: CNC Programming for Beginners“. We walk you through all the important codes – with simple explanations and real-world examples.

Want to become a super-skilled CNC programmer? Join now to take the shortcut to becoming a G Code Master today!

Make Learning G Code Easy

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.

Those chips are sharp!

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.

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 or machine manufacturer to make sure you know how your individual machine handles dwell commands.

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.

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 functions such as the spindle and coolant flow.

When using stops, the machine won’t resume the program without hitting the cycle start button either.

fanuc cnc control panel with cycle start button highlighted
Cycle start on a Fanuc control

When using G04, the machine will wait the required amount of time and then resume on it’s own.

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

Ready to master CNC programming?

Join our simple, easy-to-follow course, ‘G Code Made Easy: CNC Programming for Beginners’ and take the shortcut to becoming a G Code Master today!

Master G Code Today

Leave a Comment