G84 CNC Code Explained: An Easy Intro for Beginners [Tapping]

What is a G84 CNC code?

A G84 command activates the tapping canned cycle.

Tapping is threading the female portion of a mating pair. Basically, this means you are creating the thing that will be screwed into.

three different taps used for creating internal threads with a CNC machine

Tapping is done by rotating the spindle, which holds the tap, down through the hole until it reaches the desired depth (bottom of the hole).

Once at the bottom of the hole, the spindle will change directions and reverse out of the hole.

The G84 code is also used for peck tapping.

Peck tapping is similar to peck drilling where the machine will tap in steps. 

illustration that shows the difference between peck drilling and standard drilling in a CNC machine

For instance, if your peck depth was 0.1” then the machine would feed down 0.1” and then back up. Then the machine would feed down to 0.2” and back up. Rinse and repeat going 0.1” lower with each peck.

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 G84 code?

The G84 code is used when you want to tap (thread) an existing hole in a part.

Never use the G84 command to drill a hole.

This operation is only meant to remove the material that will form the threads of the holes, not create the hole as well.

Other codes used with the G84 code

When using a G84 code you need to consider all the aspects that control the tapping process, these are:

The retracting value (R) or clearance level refers to the plane perpendicular to the Z-axis where the tool can move safely from one hole to another.

The R value should be set so the machine will clear any and all obstacles including clamps, fixtures and the part itself.

G84 code format

The format for using a G84 command is shown below:

G98 (or G99) G84 X2.0 Y3.0 R1.0 Z-5.0 F25.0

It would be easy to assume that the Z location is the location of the start of the hole. In reality, it is the Z location for the bottom of the hole tapping movement.

Keep in mind that the X and Y coordinates of the hole are not usually in the same line as the G84 command.

In most programs you will see them in this format:

X2.0 Y3.0

G98 G84 R1.0 Z-5.0 F25.0

The program first identifies the coordinates of the hole and then starts the tapping process.

How to cancel a G84 code?

The G84 code is canceled with the G80 command.  

If the G84 code is not canceled, the machine will try to tap a hole at every new location given in the program.

The G80 command cancels all canned cycles.

What to think about when using a G84 code?

Retract planes

visualization of how a cnc machine moves using g98 and g99 codes shows motion of travel for the machine

The G84 command is usually followed by G98 in the same line of code, in which case the machine will use the Z coordinate (height of the first hole) to move between holes. Keeping in mind this aspect can prevent redundant coding and machining errors.

When tapping it is advisable to set your R plane higher than usual.

CNC machines are capable of switching between modes very quickly, but the change is not instantaneous. 

The higher R plane gives the machine time to stabilize and ensure it is working at the correct feedrate before starting the cut.

Speeds and feeds

You will need to set the spindle speed before using the G84 cycle. 

When using G84, the spindle should always be moving clockwise through the use of an M03 command.

The feed rate of code G84 will be the pitch of your thread.

Various holds or overrides for speeds and feeds will not work when tapping. This is for safety purposes.

Hole size and location

Before using the G84 there must be a previous drilling cycle.

The correct hole diameter for a tapping operation will be the final diameter of the screw minus the pitch. For example, the diameter of the hole for an M10 x 1.5 mm hole will be 8.5 mm.

Keep in mind that the X and Y coordinates of the hole are not usually in the same line as the G84 command. The standard format for selecting your hole location and calling the G84 tapping cycle is shown below:

X50.0 Y50.0

G84 Z-40.0 R5.0 F20

The machine is moved to the location of the hole to be threaded and then the hole cycle is used.

G84 rigid tapping

Rigid tapping means that the tap can remain rigid throughout the cycle. The machine spindle locks in with the feedrate similar to the screw cutting process.

There are tapping heads specially designed for this process.

To perform Rigid Tapping, the machine should be able to synchronize feed motion and spindle speed. 

This option may not be available on all machines, especially older ones.

Check your machine manual to make sure you are capable of rigid tapping.

However, Rigid Tapping mode can cause issues due to chips sticking to the tool or increased cutting resistance. That’s why it is important to consider peck tapping.

G84 peck tapping

Including the Q code in the G84 command line will immediately set the machine to a peck tapping cycle.

This means that the spindle will rotate to a specified depth (Q value) in each tapping peck and then repeat the process, one step or “peck” at a time until reaching the bottom of the hole.

Peck tapping allows chips to exit the hole, making the tapping process easier and safer. 

The downfall of peck tapping is that it increases machining time when compared to standard tapping.  

The picture below is for drilling but it is the same concept. The pecks do not need to come all the way back up either.

You can drill down 0.200″ and then retract 0.100″ and then repeat the process going down 0.100″ at a time.

illustration that shows the difference between peck drilling and standard drilling in a CNC machine

G84 vs G74

The G74 cycle is the left-hand tapping cycle, sometimes called the reverse tapping cycle.

It performs the same operation as the G84 command but with the difference that the spindle rotates counterclockwise instead of clockwise.

The G74 left hand tapping cycle creates left hand internal threads while the G84 canned cycle creates standard or right-hand internal threads. Left hand threads are the opposite of your standard threads.

If G84 creates threads that are lefty-loosey, righty tighty then G74 creates threads that are righty-loosey, lefty tighty. In other words, G74 creates threads that would be screwed in the opposite way of normal.

The G74 command also has the ability to peck tap.

Both the G74 and G84 commands are modal commands which means they will stay on and in effect until they are either changed or canceled.

The cancel command to use with both cycles is the G80 code.

Want to learn more about CNC G Code?

Leave a Comment