CNC

Tapping cycle program generator

A rigid or floating tapping program with the right feed for any thread and control.

Tapping code

G84, F25 IPM

F = RPM × pitch = 500 × 0.0500 = 25.00 IPM. Change the RPM and the feed must change with it.

Control
Holder
Hand
Feed mode

Below Z0

Need the RPM and tap drill? The threads calculator gives tapping speed by material.

Above Z0

Clear of clamps

Program

Check this program
(G84 RIGID TAP 1/4-20, 2 HOLES - HAAS)
G90 G94 G17 G54
G00 X1. Y1.
G00 Z1. (INITIAL PLANE)
G99 G84 X1. Y1. Z-0.5 R0.2 F25. S500
X2. Y1.
G80
G00 Z1.
  • G84 and G74 tap rigidly on a Haas; no M03 is needed before them: the cycle starts and stops the spindle.

Source: Haas Automation, mill G84. Dry-run it above the part first.

What next

Which tap drill for this thread?Tap drill size for any thread, cut or form tap, by percent of thread.
What peck cycle for this hole?A ready G81, G73 or G83 program with peck depth and count worked out.
Will this program run clean?A searchable G and M code list, and a checker that flags common program mistakes.
How the tapping cycle program generator works

A 1/4-20 tap at 500 RPM feeds F = 500 × 0.05 = 25 in/min in G94, or F0.05 per rev in G95; M8 × 1.25 at 800 RPM feeds 1,000 mm/min. Rigid tapping is G84 on Haas, G84.2 on Mach4, G33.1 on LinuxCNC and M29 then G84 on Fanuc.

How to program a tapping cycle: G84 feed rate and rigid tapping

Maintained by John, former CNC lathe programmer

What it calculates

A tapping cycle feeds a tap into a hole, reverses the spindle at the bottom and feeds back out. The tap advances one pitch every turn, so the feed has to match the spindle exactly: in feed per minute it is RPM × pitch, and in feed per revolution it is simply the pitch.

Rigid tapping locks the axis to the spindle, so the tap can sit in a solid holder. A floating (tension/compression) holder lets the tap move a little, for machines that can’t hold the two in step. Which code does which depends on the control. This generator writes the block for your thread, holder and control, and says where a control documents no way to do what you asked.

The formulas

Feed per minute (G94)

F = RPM × pitch

pitch
1 ÷ TPI for an inch thread (1/4-20: 0.05"), or the metric pitch in mm (M8 × 1.25: 1.25 mm)

Change the RPM and the feed must change with it.

Feed per revolution (G95)

F = pitch

pitch
the same pitch; the control multiplies by the actual spindle speed

Worked example

Two 1/4-20 holes, 0.5" deep, tapped rigid at 500 RPM on a Haas.

  1. Pitch = 1 ÷ 20 = 0.05".
  2. F = 500 × 0.05 = 25 IPM in G94.
  3. G99 G84 X1. Y1. Z-0.5 R0.2 F25. S500, then X2. Y1., then G80.
  4. On Mach4 the same hole is G84.2; on LinuxCNC it is G33.1 Z-0.5 K0.05 at each hole; on Fanuc, M29 S500 goes in front of G84.

G84 at F25. (25 IPM), or F0.05 in G95.

How to use it

What you enter

Control
Haas, LinuxCNC, Mach4, Mach3 or Fanuc.
Thread
As written: 1/4-20, #10-32, M8x1.25. The thread sets the units.
RPM
Tapping speed for your material, from the threads calculator or your tap maker.
Holder, hand and feed mode
Rigid or floating; right- or left-hand; G94 per minute or G95 per rev.
Depth, planes and holes
Tap depth below Z0, the R and initial planes, and one X, Y pair per line.

What you get

Code and feed
The tapping code for that control and the feed worked out.
Program
A commented block to copy, and a link that opens it in the checker.
Control notes
What that control does in its own way, from its maker.

Common mistakes

  • Changing RPM without the feed. In G94 the feed is tied to the RPM; change one alone and the tap strips the thread or snaps.
  • Rigid code on a floating holder, or the reverse. LinuxCNC’s G84 is not synchronized and Mach4’s G84 is for a tension/compression holder: rigid is G33.1 and G84.2 there.
  • Inch pitch from TPI. The pitch is 1 ÷ TPI, not the TPI: a 20 TPI tap at 500 RPM feeds 25 IPM, not 10,000.
  • Tapping deeper than the drilled hole. Leave room below the tap for its chamfer and the chips; the blind-hole planner in the threads calculator works the drill depth.

Sources

Feed = RPM × pitch is the thread’s geometry, as Mach4’s guide works it. Each control’s tapping codes are from its own maker; Fanuc’s M29 is shown because two published copies agree on it (CNCCookbook and PayCNC), since Fanuc’s manuals are not public. The floating-holder note is Techniks’ advice for its own holders.

How we pick and check sources