Fanuc G76 Threading Cycle Code Generator for CNC Lathes
G76 is the multi-pass threading cycle on Fanuc style lathe controls. This generator fills in the two-line format from your thread size, so you can paste a clean block into your program and then adjust for your machine.
Fill in
Fanuc G76 threading program
O1076 (M16 X 2.0 EXTERNAL) G21 G40 G97 G99 T0404 G97 S800 M03 G00 X20.0 Z6.0 M08 (G76 LINE 1: P = REPEATS, CHAMFER, TOOL ANGLE) G76 P011060 Q100 R0.05 (G76 LINE 2: X = FINAL DIA, Z = END, P = HEIGHT, Q = FIRST CUT, F = LEAD) G76 X13.546 Z-30.0 R0 P1227 Q400 F2.0 G00 X100.0 M09 G28 U0 W0 M05 M30
P code reading
P011060 is read as three pairs of digits. The first pair is the number of finishing repeats, the second is the chamfer at the end of the thread in tenths of the lead, and the third is the tool tip angle (60 for metric and Unified threads). Program numbers and tool offsets must follow your machine and tool turret.
Verify with your control manual. Fanuc 0i and 31i style controls use this two-line G76 format, but Haas, Mazak, Siemens and some Fanuc options use different parameters or an address such as K for thread height. Dry run above the part and at reduced feed override first. Thread height for an external ISO metric thread is about 0.6134 times the pitch.
Link programs to routings
Optional: we can show how to attach NC program revisions to routing operations in your ERP.
Optional. The tool and every export work without this. No spam.
How to use the generator
Enter the lead, the start and end positions and the thread height in microns. Keep the start X about 2 mm larger than the major diameter and the start Z at least two to three leads clear of the part so the spindle and feed can sync. The tool shows the first cut depth Q and the minimum cut depth, which tell the control how to degress each pass. Copy the output into your program, and rename the program number.
- Start Z should be at least 2 to 3 times the lead from the part.
- P in line 2 is the thread height in microns, with no decimal point.
- Use G97 constant spindle speed for threading.
How the cycle cuts
Line one sets the repeats, the exit chamfer, tool angle, the minimum cut depth and the finish allowance. Line two gives the target X and Z, the taper value R, the thread height P, the first cut depth Q and the lead F. The control then cuts passes with a constant-area style infeed, so each pass removes a similar chip volume, and finishes with the programmed number of spring passes. Infeed on the flank is handled by the angle setting.
Worked example
An M16 x 2 external thread has a thread height of roughly 0.6134 times 2 mm, which is 1.227 mm, entered as P1227. The final X is the major diameter 16.0 minus twice the height, so 13.546. A first cut of 0.4 mm (Q400) with a 0.1 mm minimum gives about 6 to 8 passes before the finish. At 800 rpm and 2 mm lead the feed is 1600 mm per minute, which is within what the carriage can follow on most machines.
Common mistakes
Common errors are programming the thread height as a decimal when the control wants microns, forgetting G97, starting too close to the part so the lead-in is short, and using the same cycle code on a Haas without checking the parameter letters. Always air-cut the cycle before the first part and confirm the first article with a thread gauge or measuring wires. Record the tool and the offsets in the setup sheet.
Frequently Asked Questions
What does G76 P011060 mean?
The first pair 01 means one finishing pass repeat. The second pair 10 means the exit chamfer is 1.0 times the lead. The last pair 60 is the tool tip angle in degrees, correct for 60 degree threads.
What is the difference between G76 and G92?
G92 is a single-pass threading cycle where you program each infeed. G76 is a multi-pass cycle where the control calculates the passes from the height and first cut depth, so the program is shorter.
Why is thread height in microns?
Fanuc style controls take P and Q in the second G76 line as integers in the smallest input increment, which is typically 0.001 mm. That is why a 1.227 mm height is written as 1227, with no decimal point.
Does this work on a Haas lathe?
Not directly. Haas uses its own G76 format with I, J, K, A and P addresses. Use this as a starting point for the thread data and rewrite the block to the Haas control manual before running.
If your programs live in a shop-floor system or an ERP document store, Netray can help organise program revisions and tie them to routings.
Related Tools
Unified and Metric Thread Class and Tolerance Reference
Decode thread class callouts such as 2A/2B, 3A/3B, 6g and 6H, see which have allowance and where each is normally used.
Discrete ManufacturingNPT and BSP Pipe Thread TPI and Diameter Reference
Pipe thread sizes with TPI, pitch in mm and outside diameter for NPT and BSP (G) threads, so you stop mixing them up.
Discrete ManufacturingLathe Taper Per Foot and Tailstock Offset Calculator
Calculate taper per foot, taper per inch, an approximate half angle and tailstock setover from large and small diameters.
MES & Shop FloorCNC Lathe Setup Sheet Template
A printable lathe setup sheet covering workholding, stickout, tool stations, offsets and first-piece checks, so the next operator can repeat the job.
More Discrete Manufacturing tools
See all- Tap Drill Size Chart (UNC, UNF and Metric Coarse/Fine)
- ISO Material Groups for Cutting Tools (P M K N S H) Reference
- Fanuc Macro B System Variables Reference
- Tap Drill Size Chart (Metric, UNC, UNF)
- Thread Pitch Chart (Metric, UNC, UNF)
- Drill Point Length Calculator
- Turning Cutting Time Calculator
- Thread Milling G-Code Generator
- Boring Bar Overhang Ratio Calculator