# Fanuc G76 Threading Cycle Code Generator for CNC Lathes

> Source: https://netray.co/tools/fanuc-g76-threading-cycle-code-generator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Fill in thread size, pitch, depth and length and get a Fanuc style G76 two-line multi-pass threading block with comments.

## Category

manufacturing

## Industry

Machining

## Audience

- CNC programmer
- CNC machinist
- Manufacturing engineer

## Tool

**Kind:** template

**Output:** code

**Language:** text

**Fields:**

#### Program number

**Key:** prog

**Type:** text

**Default:** 1076

#### Thread description

**Key:** size

**Type:** text

**Default:** M16 X 2.0 EXTERNAL

#### Tool number and offset

**Key:** tool

**Type:** text

**Default:** 0404

#### Spindle speed (rpm)

**Key:** rpm

**Type:** number

**Default:** 800

#### Start X (diameter)

**Key:** start_x

**Type:** text

**Default:** 20.0

#### Start Z (clear of part)

**Key:** start_z

**Type:** text

**Default:** 6.0

#### Final X (minor diameter)

**Key:** minor_x

**Type:** text

**Default:** 13.546

#### End Z (thread length)

**Key:** end_z

**Type:** text

**Default:** -30.0

#### Lead (mm)

**Key:** pitch

**Type:** text

**Default:** 2.0

#### Thread height P (microns)

**Key:** depth

**Type:** text

**Default:** 1227

#### First cut depth Q (microns)

**Key:** first

**Type:** text

**Default:** 400

#### Minimum cut depth (microns)

**Key:** mincut

**Type:** text

**Default:** 100

#### Finish allowance (mm)

**Key:** finish

**Type:** text

**Default:** 0.05

#### P code (repeats, chamfer, angle)

**Key:** pcode

**Type:** text

**Default:** 011060

**Blocks:**

#### Fanuc G76 threading program

**Body:** O{{prog}} ({{size}})
G21 G40 G97 G99
T{{tool}}
G97 S{{rpm}} M03
G00 X{{start_x}} Z{{start_z}}
M08
(G76 LINE 1: P = REPEATS, CHAMFER, TOOL ANGLE)
G76 P{{pcode}} Q{{mincut}} R{{finish}}
(G76 LINE 2: X = FINAL DIA, Z = END, P = HEIGHT, Q = FIRST CUT, F = LEAD)
G76 X{{minor_x}} Z{{end_z}} R0 P{{depth}} Q{{first}} F{{pitch}}
G00 X100.0
M09
G28 U0 W0
M05
M30

#### P code reading

**Body:** P{{pcode}} 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.

**Notes:** 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.

## Content

**Intro:** 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.

**Sections:**

#### How to use the generator

**Body:** 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.

**Bullets:**

- 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

**Body:** 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

**Body:** 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

**Body:** 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.

**Cta:** 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.

**Faq:**

#### What does G76 P011060 mean?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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.

## Search terms

g76 threading cycle example, fanuc g76 code, cnc lathe threading program, g76 p parameters explained, g76 threading generator, lathe thread g code, g76 vs g92, cnc threading cycle format

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
