NC

Canned cycles at a glance: how G81, G83, G73, G84 and others move, and how to choose (machining center and lathe)

Once you know the type of hole, the canned cycle to use is decided. Don't forget G80 at the end!

Chips, the Kezuriba mascot
Canned cycles at a glance: how G81, G83, G73, G84 and others move, and how to choose (machining center and lathe)

For work like drilling, tapping and boring, where "the same motion is repeated many times", you can use canned cycles, which let you write the motion in one line. This article lists machining center G73–G89 and lathe G70–G76 and G90/G92/G94 with motion diagrams, and covers how to choose one and where mistakes tend to happen. The code follows FANUC-style controls (G-code system A).

What kind of hole?Drill a holeG81Shallow hole, center drillG82Counterbore, chamfer (dwell)G73Deep hole, break chipsG83Deep hole, clear chips outTap a threadG84Right-hand (fwd → rev)G74Left-hand (rev → fwd)Finish a holeG85Reamer (feeds out)G89Stepped bottom (dwell)G86Rough / semi-finish boringG76Finish boring (shift, retract)Counterbore from behindG87Back counterbore (back boring)Rigid tapping:M29 S_ etc. before G84(switching varies by machine)Return heightG98 = back to initial pointG99 = next hole at R pointUse G98 to clear clampsAlways cancel with G80 at the end (so drilling doesn't continue on the next move)
How to choose a canned cycle from the type of hole. Tap a code to go to its explanation in the G-code dictionary. Check the machine's operation manual for detailed conditions.

What is a canned cycle? One block for rapid → cut → return

For example, drilling a hole normally takes three or more blocks: rapid to above the hole, cutting feed to the hole bottom, then rapid back. A canned cycle replaces this fixed motion with the single block G81 X_ Y_ Z_ R_ F_ so for the second and later holes you only need to write X and Y to repeat the same motion[1]. Always cancel it with G80 at the end.

AddressMeaningNotes
X, YHole positionRapids here first, then drilling starts
ZHole bottom positionCoordinate in G90 (absolute); distance from the R point in G91 (incremental)
RR point (height where it switches to cutting feed)In G91 it is the distance from the initial point. Place it slightly above the workpiece surface
QDepth of cut per peck (G73, G83) / shift amount (G76, G87)Unsigned incremental value. 0 and negative values cannot be used[8]
PDwell at the hole bottom (stop time)Units vary by machine (seconds or milliseconds, decimal point handling)
FCutting feedFor tapping: pitch × rpm (feed per minute)
K (L)Repeat countCombine with G91 to drill evenly spaced holes

G98 and G99: the height at which the tool moves to the next hole after drilling

G98 goes back to the initial point (the height before entering the cycle), while G99 stays at the R point and moves to the next hole from there. G99 is faster, but it will hit a clamp or step between holes. It is standard to use G98 only for holes that cross an obstacle.

Diagram: Height to move to the next hole after drilling

G98: return to initial pointClampInitial pointR pointG99: move at R point heightClampInitial pointR pointCollides if in the way
G98 returns to the initial point (the height before entering the cycle) after drilling and then moves to the next hole. G99 moves at the R point height, which is faster, but collides with a clamp or step in the way.

Canned cycles for machining centers at a glance

Tap a code to go to its dictionary page, which covers syntax, differences between manufacturers, and a motion diagram.

CodeUseHow it cutsAt bottomReturn
G81Center holes, shallow holesDrilling cycle (spot drilling)Cutting feed straight to the bottom—Rapid
G82Counterbores, chamfers (clean bottom)Drilling cycle (counterboring, dwell at bottom)Cutting feed straight downDwell (P)Rapid
G73Deep holes (break chips)High-speed peck drilling cycle (chip break, small retract)Q at a time; retracts slightly each time—Rapid
G83Deep holes (clear chips out of the hole)Peck drilling cycle (retracts to the R point each time)Q at a time; pulls out to the R point each time—Rapid
G84Right-hand tapsTapping cycle (right-hand)Cutting feed with spindle CWReverse (CCW)Cutting feed
G74Left-hand tapsReverse tapping cycle (left-hand tap)Cutting feed with spindle CCWForward (CW)Cutting feed
G85Reaming, boringBoring cycle (feeds in and feeds out)Cutting feed—Cutting feed (strokes the bore on the way out)
G89Finishing the bottom of stepped holesBoring cycle (dwell at bottom, feeds out)Cutting feedDwell (P)Cutting feed
G86Boring (rough, semi-finish)Boring cycle (spindle stops at bottom, rapid out)Cutting feedSpindle stopRapid (the cutting edge may leave a line)
G76Finish boring (no return scratch)Fine boring cycleCutting feedOriented stop → shift by QRapid
G87Back counterbore (back boring)Back boring cycle (back counterboring)Bottom to top—Shifts the tool and pulls out
G88Boring with manual retract (rare today)Boring cycle (dwell at bottom, spindle stops, manual return)Cutting feedDwell, spindle stopManual

Code numbers are common to FANUC-style controls, but some manufacturers have exceptions. For example, on Haas machining centers back counterboring is G77, and G87 is not in the list[5]. Check the code numbers in your own machine's manual before using them.

Drilling: G81, G82, G73 and G83 compared

G81 is the most used. It rapids to the R point, drills in one go at cutting feed to the hole bottom, and rapids back. When you want a clean bottom for counterbores or chamfers, use G82, which dwells for P at the hole bottom.

Diagram: G81 motion (side view)

RapidCutting feedInitial pointR pointHole bottom Z① Rapid to R point② To hole bottom ZCutting feed③ Rapid return
Rapid to the R point, then cutting feed from the R point to hole bottom Z. Figure shows G98 (return to initial point); with G99 it stops at the R point and moves to the next hole.

Deep holes use "pecking": G73 for speed, G83 for chip evacuation

If you drill a deep hole in one go, chips pack the flutes and the drill breaks. Peck drilling avoids this by cutting in steps of Q.

  • G73 (high-speed peck drilling): after every Q of cut it retracts slightly to break up the chips. It does not pull out of the hole, so it is fast, but weak at clearing chips out
  • G83 (deep hole peck drilling): after every Q of cut it pulls out to the R point to clear the chips, rapids back to just short of the previous depth, and then cuts again. It takes longer, but is strong on deep holes and materials whose chips pack easily

Diagram: G73 motion (side view)

RapidCutting feedQInitial pointR pointHole bottom Z① Rapid to R point② Cut in by Q③ Retract slightly (d)to break the chips④ Repeat to hole bottom⑤ Rapid return
Cuts in by Q each time, retracting a little (d, a machine setting) each time to break the chips. It doesn't retract out of the hole, so it is fast, but chip evacuation is weaker than G83. Figure shows G98.

Diagram: G83 motion (side view)

RapidCutting feedQInitial pointR pointHole bottom Z① Rapid to R point② Cut in by Q③ Rapid out to R pointto clear chips④ Rapid back to dabove previous depth⑤ Repeat to hole bottom⑥ Rapid return
After each cut of Q, it retracts to the R point to clear chips, then rapids back to d (a machine setting) short of the previous depth and cuts again. Figure shows G98.

Which one to useIf the chips come out once they are cut fine, use G73; if they stay in the flutes even when cut, or the hole is deep, use G83. The retract amount and the clearance before re-entry (d) are set on the machine side (Setting 22 and 52 on a Haas)[7].

Tapping: G84 (right-hand) and G74 (left-hand)

G84 feeds in with the spindle running forward, reverses at the hole bottom, and feeds out. The feed is rpm × pitch (for feed per minute). For example, tapping M10×1.5 at 500 min⁻¹ gives F750[3]. You can calculate it with the tapping cutting-conditions calculator.

Diagram: G84 motion (side view)

RapidCutting feedReverse spindle at bottomInitial pointR pointHole bottom Z① Rapid to R point② Tap in with feed,spindle CW③ Reverse at bottom④ Feed out toR point (back to CW)⑤ Rapid to initial point
Taps in with feed with the spindle forward, reverses at the hole bottom and feeds out (right-hand thread). Feed = rpm × pitch. Figure shows G98 (rapid from R point to initial point).

The method that synchronizes spindle rotation and feed is called rigid tapping, and on FANUC-style controls it is often switched on by writing M29 S_ before G84, but how to switch it varies by machine (About M29). Do not mix it with the older method that uses a compensating chuck (floating tap holder). On most machines the feed override has no effect during tapping.

Reaming and boring: G85, G86, G89, G76 and G87

  • G85: cutting feed both in and out. A reamer or rough boring bar strokes the bore surface back and forth
  • G89: G85 with a dwell at the hole bottom added. Finishes the bottom face of a stepped hole
  • G86: stops the spindle at the hole bottom and pulls out at rapid. Fast, but the cutting edge may leave a line on the bore
  • G76 (fine boring): at the hole bottom it brings the spindle to an oriented stop, shifts away from the cutting edge by Q, and then pulls out. No return scratch is left on the finished bore. The shift direction is set by a machine setting, and if it does not match the direction of the boring bar's cutting edge, the shift cuts the bore
  • G87 (back counterboring): passes through the hole with the tool shifted away, shifts it back on the far side, and cuts upward. The R point is below the hole, so the way of thinking is the reverse of the other cycles

Diagram: G85 motion (side view)

RapidCutting feedInitial pointR pointHole bottom Z① Rapid to R point② Feed to hole bottom③ Feed to R point(pull out)④ Rapid to initial point
Cutting feed both in and out. A reamer or boring bar strokes the bore surface in and out. Figure shows G98 (rapid from R point to initial point).

Diagram: G76 motion (side view)

RapidCutting feedQInitial pointR pointHole bottom Z① Rapid to R point② Feed to hole bottom③ Orient spindle stop④ Shift away from thecutting edge by Q⑤ Rapid out⑥ Shift back, spin spindle
At the hole bottom the spindle is stopped at an oriented position and shifted away from the cutting edge by Q before rapid retraction, so no return scratch is left on the bore. Shift direction is set by a machine setting. Figure shows G98.

Lathe canned cycles: single-type (G90, G92, G94) and multiple-type (G70–G76)

On a lathe (G-code system A), the same code number has a different meaning than on a machining center. G90 is not absolute programming but the OD cutting cycle, and G94 is not feed per minute but the facing cycle. Be especially careful when reusing a program written for a machining center[4].

CodeTypeMeaning
G90Single-typeOD/ID cutting cycle (single-type canned cycle, G-code system A)
G92Single-typeThreading cycle (single-type canned cycle, G-code system A)
G94Single-typeFacing cycle (single-type canned cycle, G-code system A)
G70Multiple-typeFinishing cycle (finishes the shape roughed out by G71–G73)
G71Multiple-typeOD/ID rough cutting cycle (cuts in the Z direction)
G72Multiple-typeFacing rough cutting cycle (cuts in the X direction)
G73Multiple-typeClosed-loop cutting cycle (pattern repeating; cuts along the blank shape, e.g., castings)
G74Multiple-typeFace grooving (cut-off) cycle / peck drilling of deep holes in Z
G75Multiple-typeOD/ID grooving (cut-off) cycle
G76Multiple-typeMultiple threading cycle

Single-type cycles perform the 4 motions "infeed → cut → retract → return" in one block, and you keep cutting with many blocks that change only X. Multiple-type cycles create the roughing passes automatically once you write the finish profile (the blocks from P to Q). The basic combination is to rough with G71 and then finish with G70 specifying the same P and Q.

Diagram: How G71 (lathe) cuts

ZXΔdFinish allowance (orange dotted)Start pointFinish profile (P–Q)
Cuts with Z-direction passes by Δd each, down to the line that leaves the finish allowance on the finish profile (P–Q). At the end of each pass it backs off a little (e) at 45° and returns by rapid; a final pass follows the profile once. Finish with G70.

Diagram (lathe): G76 (lathe), multiple threading cycle

Each passInfeed method (enlarged)Threaded sectionAEEnds with an angled pull-out1234Finish (d)ΔdkDepth of pass n = Δd × √n
Infeeds along one flank of the thread (flank infeed). The depth of pass n is Δd × √n, so the infeed shrinks and each pass removes about the same amount; the finishing allowance d is cut last. k is the thread height.

Watch the U in the 2 blocks of G71G71 uses a 2-block format. The U in the first block is the depth of cut, while the U in the second block is the finishing allowance in X. The same address means different things in each block, and mixing them up cuts too much. The P, Q, and R of G76 (threading) also change meaning between the first and second blocks.

Program example: tapping M10 holes at 4 locations

The sequence is center drill → φ8.5 tap drill hole by peck drilling (G83) → M10×1.5 rigid tapping (G84). Only the holes with a clamp in between return to the initial point with G98. Tool numbers, spindle speeds, feeds, and Q are examples; in practice, use the tool manufacturer's recommended conditions and match them to your machine.

O1001 (M10 TAP x4)
G90 G17 G40 G49 G80          (safety block)
G54
T01 M06                      (center drill)
S1500 M03
G00 X20. Y20.
G43 Z50. H01 M08
G99 G81 X20. Y20. Z-3. R3. F120   (return to R point, then next hole)
X80.
G98 X80. Y60.                (clamp ahead: return to initial point)
G99 X20.
G80 M09
G91 G28 Z0.
T02 M06                      (φ8.5 drill)
S1100 M03
G90 G00 X20. Y20.
G43 Z50. H02 M08
G99 G83 X20. Y20. Z-25. R3. Q5. F160
X80.
G98 X80. Y60.
G99 X20.
G80 M09
G91 G28 Z0.
T03 M06                      (M10x1.5 tap)
G90 G00 X20. Y20.
G43 Z50. H03 M08
M29 S500                     (rigid tapping: varies by machine)
G99 G84 X20. Y20. Z-20. R5. F750  (F = 500 x 1.5)
X80.
G98 X80. Y60.
G99 X20.
G80 M09
G91 G28 Z0.
M30

Putting G80 in the safety block is standard practice, even in university lab programs and Haas examples[10]. Even if a canned cycle is left over from the previous program, the first move won't start drilling.

7 common mistakes

  1. Forgetting G80: a canned cycle is modal, so drilling continues even at the next G00 X_ Y_
  2. Crossing a clamp while still in G99: the tool moves sideways at R-point height and crashes. Use G98 for holes just before an obstacle
  3. Writing R and Z as absolute values in G91: in incremental mode, R is the distance from the initial point and Z is the distance from the R point
  4. Wrong sign or decimal point in Q: Q is unsigned. On machines that read values without a decimal point in the smallest input unit, Q5 becomes 0.005 mm
  5. Miscalculated F for tapping: for feed per minute, spindle speed × pitch; for feed per revolution, the pitch itself
  6. G76 shift direction opposite to the tool orientation: the shift cuts the finished bore
  7. Using G90 and G94 with machining-center habits on a lathe: on a system A lathe they are cutting cycles

For how to remove a tap that has broken, also see “Tap breakage” in the Machining Troubleshooting Encyclopedia.

FAQ

Can I use cutter radius compensation (G41/G42) with canned cycles?
No. Canned cycles assume cutter radius compensation is not applied (per the NIST RS274NGC specification)[8]. Cancel it with G40 before using a cycle.
Is the repeat count K or L?
It depends on the machine. Most FANUC-type controls use K; older machines and some makers use L.
Which is faster, G73 or G83?
G73. Because it doesn't pull out of the hole every time, there is less air cutting. However, chips don't come out of the hole, so G83 is safer for deep holes and sticky materials.

Sources

  1. Mitsubishi Electric, "The Basics of CNC Machining Programming (for Machining center)" e-learning material (PDF)
  2. Mitsubishi Electric, "The Basics of CNC Machining Programming (for Lathe)" e-learning material (PDF, BNP-C8027-688)
  3. Siemens AG, "SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Milling, 04.2007 Edition (6FC5398-7BP10-0BA0)"
  4. Siemens AG「SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition」
  5. Haas Automation, Inc., "Mill Operator's Manual – 17 Mill G-Codes" (online edition)
  6. Haas Automation, Inc., "Lathe Operator's Manual – 16 Lathe G-Codes" (online edition)
  7. Haas Automation, Inc., "G-code, M-code, and Setting" (explanations by code)
  8. National Institute of Standards and Technology (NIST), "The NIST RS274NGC Interpreter – Version 3" (NISTIR 6556, 2000)
  9. Ministry of Health, Labour and Welfare, Ability Evaluation Office, Human Resources Development Bureau, "Human Resource Development Manual Using the Practical Test Tasks of Grade 3 Skill Tests: Numerically Controlled Lathe Work (March 2018)" (in Japanese)
  10. Saitama University, Faculty of Engineering, Department of Mechanical Engineering, lab course, "Machining Center Program 2019 (lab NC program O19-0101, with comments)" (in Japanese)

More articles