G76 Threading Cycle for CNC Lathes (Fanuc)

G76 Threading Cycle for CNC Lathes (Fanuc, Haas, Mach3, and LinuxCNC)

CNCCookbook’s G-Code Tutorial

G76 Threading Cycle G-Code Basics

In this section, we walk through the different parameters to tell the G76 threading cycle how to cut the specific thread you want.  We’ll be covering a variety of dialects including Fanuc Controls, the Haas G76 Threading Cycle, Linux CNC/Path Pilot, and Mach 3.

Thread Start and End Positions

The first thing you’ll need to come up with is the thread’s start position and end position. The end point is perhaps a bit easier, particularly in Z, as you generally know exactly the length you want threaded and where that thread starts. The ending diameter is not too bad either as the thread’s specification will tell you that.

Incidentally, our G-Wizard Thread Calculator software has a nice database of common threads that calls out this sort of thing. Here’s a typical screen shot:

G-Wizard Thread Calculator has a database of common threads…

If you don’t have software like G-Wizard Calculator, you’ll have to leaf through your Machinery’s Handbook or something similar to find the information.  There are many different thread standards such as the Unified Thread Standard, so make sure you have the correct data for your thread.

The Start Position is a little more interesting. You’ll obviously want to start somewhere outside the threads. You need to leave some allowance in Z to give the CNC lathe time to synchronize the feedrate with the spindle rotational position. It turns out that cutting threads puts more stress on the cutter than a lot of other operations, so you want to turn the OD (External threads) or ID (Internal threads) to get close to the top of the thread to minimize the amount of cutting needed by the threading tool. This will determine the X coordinate you start from. I typically turn down to the top of the thread tooth and use a finish allowance so there’s a nice surface there.

Thread Height

This is another value that comes from a thread spec, so it’s easy to come by. In the screenshot above, use 0.0433″ for the 1/4-20 thread.  Note that this value is also referred to as thread depth.

Taper Amount

Pipe threads are often tapered to improve sealing. You can specify a taper amount on the G76 threading cycle when cutting such threads.

Thread Pitch or Lead

For most G76 threading cycles, this is specified as a Feedrate. It’s another value you can pull out of your thread database. For the 1/4-20 thread above, the pitch is 0.050″ (1/20 TPI) and the Lead is 20 TPI.

Thread Infeed Angle (also called Tool Nose Angle)

Back in the days of manual lathes, the machinist used to set the compound slide at an angle to the thread that’s called the thread infeed angle. Being able to set that angle is important to ensuring a constant amount of material is removed and that the cutting spreads the wear to both sides of the insert or cutter.

Illustration by Sandvik shows three infeed strategies…

The illustration above, courtesy of Sandvik, shows thread infeed strategies:

– Radial Infeed: Go straight in with a 0 degree angle. Note that the force increases steadily into the cut as more area is being cutter the deeper we go.

– Modified Flank Infeed: Go in at an angle, which helps spread the wear and keep the force constant.

– Incremental Infeed: Alternate side-to-side while feeding at an angle.

Radial Infeed is quick and dirty, but it produces a stiff V-shaped chip which may have difficulty forming. The insert tip can also reach very high temperatures. This method is suitable for fine pitches, but for coarse pitch threads it often results in too much vibration (chatter) and poor chip control.

The Modified Flank Infeed is the one most commonly programmed in CNC machines. By choosing the right angle, we can avoid having the insert rub. Chips are formed much more easily. The chips are thicker than for a Radial Infeed, but they are much better behaved. As a result, fewer passes are often required and less heat is generated.

When specifying the thread angle, most people use an A58 for a 60 degree thread tool. This will cause the tool to move in at a 29 degree ( 58 / 2 ) angle on each pass thus cutting mostly on one side and just a little on the other side. if you program an A60 the tool will feed in at a 30 degree angle just cutting on one side.

If you’ve got a really large thread to cut, the Incremental Infeed method is probably best. Unfortunately, Incremental Infeed is not available on most G76 threading cycles.


First Cut Depth

This value specifies the depth of the first pass. This should be the deepest cut you make since each subsequent cut will be harder on cutter and machine if you make every subsequent pass as deeply as the first one. The reason is the triangular shape of the thread cutter. As you push the triangle deeper into the cut, more and more area is being cut.

How much material should you try to remove on that first cut?

You can consult the cutter manufacturer, go on your experience, or you could use G-Wizard Calculator’s handy Cut Depth Calculator:

GW Calculator suggest a depth of 0.018″ for the first pass on a 1/4-20 thread…

GW Calculator suggest a depth of 0.018″ for the first pass on a 1/4-20 thread, and it even estimates it will take 6 passes to cut the thread. We’ll talk about the passes in a minute, but suffice to say that unless you actually simulate ALL the parameters of the G76 threading cycle, you can only estimate the number of passes that will be needed.

Minimum Cutting Depth

Most versions of G76 threading cycle allow you to specify a minimum cutting depth. This ensures things won’t take too long by running excessively small depth passes. Given that G76 threading cycle can automatically adjust cut depth on each pass to equalize the amount of material removed, the passes will get smaller, and it takes a fair amount of calculation to figure out how much any given pass will be taking off.

This parameter just makes it easy to get control over that. Be careful not to get too carried away with it though. For most GCode dialects, specifying a Minimum Cut Depth that’s larger than the Finish Allowance may prematurely end the threading cycle without taking the finish pass.

Finish Allowance

This is a typical finish allowance. It’s meant to be light so you can get good surface finish and minimize deflection. Even so, you may want some Spring Passes (see below) to ensure the threads are clean and accurate.

Spring Passes

A Spring Pass is a pass cut at the same depth as the prior pass. It’s called a “Spring Pass” because it is combating the tendency of the part to spring away from the cutting pressure and then spring back afterward without having the full depth of cut taken. These passes can help clean up and debur a thread and minimize errors in the thread’s dimensions.

Some versions of the G76 threading cycle have a built-in parameter for spring passes. For example, in the Fanuc controls double block format, digits 1 and 2 of the P-word specify the number of passes to make. In Mach 3, Q specifies passes, and in LinuxCNC it is H.  Be sure you know what your cnc control uses.

Other controls may specify passes with a parameter, or they may not have a way to specify passes. When you don’t have a way to specify spring passes, you can use G92 to specify them. Just program one or more G92’s right after the G76 threading cycle and you’ll retrace the thread contour perfectly.

Typically, two Spring Passes is plenty and one will often suffice, so it’s quick and easy to slap in one or two G92’s after the G76 threading cycle.

Chamfering Options

When you cut a thread to a shoulder, it’s nice to chamfer the end of the thread so it ends cleanly at the shoulder. That’s what your Chamfering Options are designed to allow.


G76 Threading Cycle Tips and Thoughts on Passes


The number of passes that must be cut to make your thread is very important. Take too few passes, and surface finish is apt to be poor and you might even break your threading tool by forcing it to work too hard. Take too many passes and you’re going to waste a lot of time.

You can’t change most of the information relating to the thread’s specifications, so your primary tools for controlling the number of passes include:

– Start Position: Turn things down as I describe above to minimize the work the threading tool must do.

– First Pass Depth: Pick the largest pass you can. G-Wizard Calculator will give you a good recommendation here.

– Minimum Pass Depth: Try to avoid using this parameter too much and set it to your Finish Allowance.

– Finish Allowance: A smaller finish allowance can mean larger roughing passes remove most of the material. Just remember, too small an allowance will force your cutter to rub.

– Spring Passes: You shouldn’t need more than 2 passes and 1 may suffice. Experiment with your particular situation to see if you can get by with 1 or perhaps even no extra passes.

Your next challenge will be in determining how many passes the cycle will actually make. This is not easy as G76 threading cycle will dynamically change the depth of each pass after the first to equalize the amount of material removed. You have to do quite a lot of calculation to figure out exactly how many passes will be made.

But there if you have a GCode Simulator, it may be able to help out. Take a look at this screen shot of G-Wizard Editor:

G-Wizard Editor will tell you in the hint below the backplot how many passes the G76 threading cycle will take…

G-Wizard Editor will tell you in the hint below the backplot how many passes the G76 threading cycle will take. You can use it to help tune your G76 threading cycle so it doesn’t have an excessive number of passes. Note the WARNING message given that tells you the finish allowance will not be used due to the Minimum Cut Depth being larger. That’s also helpful when setting all this up.

Don’t Feed Too Fast

Many lathes have problems synchronizing the spindle if fed too quickly. If your threading passes are not synchronizing, try slowing down until it improves. Typically, this means slowing the RPM, which determines how fast you’ll be feeding based on your thread pitch.

Code Dialects for G76 Threading Cycle

Hopefully you’ve gathered up the values for all the parameters described above. Perhaps you can use a spreadsheet to make that process easier and more complete. Now you’re ready to plug the parameters into the particular GCode dialect used by your cnc control:

Fanuc Double Line G76 Threading Cycle

Here is the syntax for the Fanuc CNC Control:

G76 P(m) (r) (a) Q(dmin) R(d)

G76 X(U) Z(W) R(i) P(k) Q(d) F(L)

P Word:  The P-word has 6 digits consisting of three 2-digit clusters for m, r, and a.

    m:  Repetitive finishing count (1 to 99)–spring passes.

    r:  Chamfering amount (1 to 99)

    a:  Angle of Tool Nose.  Select 80, 60, 55, 30, 29 or 0 degrees.

Q Word:  dmin is the Minimum Cutting Depth.  If the depth of either a roughing or finish pass is less than this, it is clamped to be at least this much.

R Word: d is the finish allowance.

X/Z/U/W words (2nd line):  Specify the coordinates of the end point.  X, Z use the current mode (absolute or relative) while U, W can be used to specify a relative position.

R Word (2nd line): i is the taper amount when cutting tapered threads.

P Word (2nd line):  k is the thread height (thread depth) expressed as a radius (not diameter) value.

Q Word (2nd line):  d is the depth of the first cut.

F Word (2nd line): L is the lead of the thread.

Example: Fanuc Controls 2 line G76 threading cycle cutting a tapered pipe thread:

G-Wizard Editor will tell you in the hint below the backplot what all the G76 threading cycle parameters are doing…

Fanuc Single Line G76 Threading Cycle

G76 X.. Z.. I.. K.. D.. F.. A.. P..
X = Diameter of last threading pass
Z = Position of the thread end
I = Taper over total length
K = Thread Depth: Single depth of the thread – positive
D = Depth of first threading pass – positive
A = Included angle of the insert – positive
P = Infeed method (one of 4)

Haas G76 Threading Cycle

G76 D.. K.. X.. Z.. U.. W.. I.. P.. F.. A..

D = Initial cut depth

K = Thread height (ala Thread Depth)

X* = X-axis absolute ending location

Z* = Z-axis absolute ending location. Determines thread length.

U* = X-axis incremental distance to end. May be used instead of X.

W* = Z-axis incremental distance to end. May be used instead of Z.

I* = Thread taper amount (radius measure).

P* = Subsequent pass positioning method (1-4)

Q* = Thread Start Angle (do not use a decimal point)

F* = Feedrate

A* = Tool nose angle (0 -120 degrees. 0 assumed if not specified)

LinuxCNC / PathPilot G76 Threading Cycle

G76 P.. Z.. I.. J.. R.. K.. Q.. H.. E.. L..
P = Thread pitch in distance per revolution
Z = Final position of threads
I = Thread Peak offset. Negative for external, positive for internal.
J = Initial cut depth
K = Full thread depth
R = Depth digression (optional). R = 1 is constant depth, R =2 is constant areas.
Q = Compound slide angle (optional)
H = Spring passes (optional)
E = Distance along drive line for taper
L = Which end of the thread gets tapered. L0 = no taper. L1 = entry taper. L2 = exit taper. L3 = entry and exit taper.

Mach 3 G76 Threading Cycle

G76 X.. Z.. Q.. P.. H.. I.. R.. K.. L.. C.. B.. T.. J..
X = X end
Z = Z end
Q = Spring passes (optional)
P = Pitch
H = Depth of first pass
I = Infeed angle
R = X Start (optional)
K = Z Start (optional)
L = chamfer (optional)
C = X Clearance
B = Depth Last Pass (optional)
T = Taper (optional)
J = Minimum depth per pass (optional)



1. Dig out the programming manual for your CNC Control and make sure you understand your machine’s G76 threading cycle syntax. If you’re using G-Wizard Editor to help simulate such things, set it up for your control’s syntax if it isn’t already built into the post.

2. Try some G76 threading cycle examples on your own for common threads you use in your projects.  Be sure to try both Internal Threads and External Threads.

3. Try optimizing the number of passes your G76 threading cycle examples need to get the job done.

Recently updated on April 30th, 2024 at 11:00 am