Quick answer

The tool centre runs on a radius of (thread diameter − tool diameter) ÷ 2 inside a hole, or (minor diameter + tool diameter) ÷ 2 outside, and Z moves one pitch per revolution. An M12 × 1.75 internal thread 6 mm deep with a 9 mm single-point tool runs at R1.500 mm and needs 4 revolutions. A 1/2-13 internal thread 0.5" deep with a 0.375" tool runs at R0.0625" with 7 revolutions. Right-hand internal threads climb upwards with G03.

Source: Helical interpolation geometry for a right-hand thread with climb milling; check thread mill data with the tool maker. Reviewed . Use the calculator below for any other size.

Thread Milling G-Code

Generate helical interpolation toolpaths for internal or external Right-Hand threads. Uses Climb Milling best practices by default.

Geometry
Generated Toolpath
Climb Milling Strategy

Internal RH: Tool feeds from the bottom up (Z increases) using G03 to ensure proper climb cutting.

Tool Clearance

A smooth 180° arcing lead-in and lead-out is automatically generated to prevent witness marks on the thread wall.

How the Thread Milling Generator Works

Thread milling cuts a thread by moving a rotating thread mill around a helix: one full circle in X and Y while Z moves by one pitch. The generator works out the radius of the tool-centre path from the thread and tool diameters, then writes arc-in, helical and arc-out moves for a right-hand thread with climb milling.

For an internal thread, the tool plunges to depth in the centre of the pre-drilled hole and climbs upwards with G03 (anticlockwise). Anticlockwise with Z rising gives a right-hand helix, and inside a bore it is a climb cut. For an external thread, the tool starts above the part and works downwards with G02 (clockwise). Clockwise with Z falling is also right-hand, and outside a diameter it is the climb direction.

A single-point tool (one row of teeth) needs as many revolutions as there are pitches in the thread length. A full-profile tool has teeth along its length, and the generator gives it one revolution.

The Formulas

Path geometry
P = 1 ÷ TPI (inch) or pitch in mm
Internal: Rpath = (Dthread − Dtool) ÷ 2
External: Rpath = (Dthread + Dtool) ÷ 2
Revolutions = ⌈(Zstart − Zend) ÷ P⌉ (1 for full-profile)
The tool diameter is the thread mill's largest cutting diameter. For internal threads enter the major (nominal) diameter. For external threads enter the minor (root) diameter, which is the diameter the tool tips must reach.
Lead-in, helix and lead-out
Lead-in: 180° arc, Z changes by P ÷ 2
Helix: full circles, I = −Rpath, Z changes by P each
Lead-out: 180° arc, Z changes by P ÷ 2
Safe Z = Zstart + 0.1 in or 2.5 mm
Inside, the lead arcs have radius Rpath ÷ 2 and start and end at the hole centre. Outside, the tool starts max(tool diameter, 0.1 in or 2.5 mm) beyond the path, and the G03 lead arcs blend tangentially into the G02 helix.

Worked Examples

Metric: M12 × 1.75 internal
  • Thread Ø12, pitch 1.75, single-point tool Ø9, Z0 to Z−6, F200
  • Rpath = (12 − 9) ÷ 2 = 1.500 mm
  • Revolutions = ⌈6 ÷ 1.75⌉ = ⌈3.43⌉ = 4
  • Lead-in: G03 X1.500 Y0.000 Z-5.125 I0.750
  • Helix ends at Z1.875 and the lead-out at Z2.750, back at the centre
Imperial: ½-13 internal
  • Thread Ø0.5, 13 TPI, single-point tool Ø0.375, Z0 to Z−0.5
  • P = 1 ÷ 13 = 0.0769 in, Rpath = (0.5 − 0.375) ÷ 2 = 0.0625 in
  • Revolutions = ⌈0.5 ÷ 0.0769⌉ = ⌈6.5⌉ = 7
  • Lead-in to Z−0.4615, helix to Z0.0769, lead-out to Z0.1154

Because the revolutions are rounded up, the helix finishes a little past the thread length: above the top for internal threads, and up to one pitch below Z End for external threads. Leave room for that.

Tips for Using the Results

  • Feed is at the tool centre. The F value is written exactly as entered and applies to the tool centre. Inside a hole the cutting edge travels faster than the centre, by Dthread ÷ (Dthread − Dtool). Use the Circular Feed calculator to convert an edge feed to a centre-line feed.
  • Size the hole first. Internal threads need a pre-drilled hole at the minor diameter. Get the size from the Tap Drill calculator.
  • Adjust the fit with the tool diameter. The code has no cutter compensation. Entering a slightly smaller tool diameter makes the path cut deeper on both internal and external threads. Check the pitch diameter with a gauge or by the three-wire method.
  • Preview before cutting. Paste the output into the G-Code 3D Viewer to check the depth, the direction and the number of turns.

Frequently Asked Questions

Moving anticlockwise while Z rises traces a right-hand helix. With the spindle running clockwise (M03), anticlockwise travel inside a bore is climb milling, which gives a better finish and less tool deflection than conventional milling.

Clockwise travel with Z falling is also a right-hand helix. Outside a diameter, clockwise travel with an M03 spindle is the climb direction. The lead-in and lead-out arcs use G03 because they approach from outside and blend into the clockwise helix.

Enter the minor (root) diameter the tool tips must reach, not the nominal size. The path radius is that diameter plus the tool diameter, halved. If you enter the major diameter, the tool will only skim the outside of the blank.

No. The generator only writes right-hand threads. A left-hand thread needs the opposite arc direction for the same Z direction, so the code would have to be changed.

A single-point tool has one row of teeth and must travel the whole thread length, one pitch per revolution. A full-profile tool has teeth along its length and cuts the full length in one revolution, so the generator writes a single helix turn.

Generated code is a starting point. Check tool data, thread dimensions and feeds against your tooling manufacturer's recommendations, and prove the program with a dry run before cutting.