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!


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 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.
| Address | Meaning | Notes |
|---|---|---|
| X, Y | Hole position | Rapids here first, then drilling starts |
| Z | Hole bottom position | Coordinate in G90 (absolute); distance from the R point in G91 (incremental) |
| R | R 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 |
| Q | Depth of cut per peck (G73, G83) / shift amount (G76, G87) | Unsigned incremental value. 0 and negative values cannot be used[8] |
| P | Dwell at the hole bottom (stop time) | Units vary by machine (seconds or milliseconds, decimal point handling) |
| F | Cutting feed | For tapping: pitch × rpm (feed per minute) |
| K (L) | Repeat count | Combine 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
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.
| Code | Use | How it cuts | At bottom | Return |
|---|---|---|---|---|
| G81 | Center holes, shallow holesDrilling cycle (spot drilling) | Cutting feed straight to the bottom | — | Rapid |
| G82 | Counterbores, chamfers (clean bottom)Drilling cycle (counterboring, dwell at bottom) | Cutting feed straight down | Dwell (P) | Rapid |
| G73 | Deep holes (break chips)High-speed peck drilling cycle (chip break, small retract) | Q at a time; retracts slightly each time | — | Rapid |
| G83 | Deep 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 |
| G84 | Right-hand tapsTapping cycle (right-hand) | Cutting feed with spindle CW | Reverse (CCW) | Cutting feed |
| G74 | Left-hand tapsReverse tapping cycle (left-hand tap) | Cutting feed with spindle CCW | Forward (CW) | Cutting feed |
| G85 | Reaming, boringBoring cycle (feeds in and feeds out) | Cutting feed | — | Cutting feed (strokes the bore on the way out) |
| G89 | Finishing the bottom of stepped holesBoring cycle (dwell at bottom, feeds out) | Cutting feed | Dwell (P) | Cutting feed |
| G86 | Boring (rough, semi-finish)Boring cycle (spindle stops at bottom, rapid out) | Cutting feed | Spindle stop | Rapid (the cutting edge may leave a line) |
| G76 | Finish boring (no return scratch)Fine boring cycle | Cutting feed | Oriented stop → shift by Q | Rapid |
| G87 | Back counterbore (back boring)Back boring cycle (back counterboring) | Bottom to top | — | Shifts the tool and pulls out |
| G88 | Boring with manual retract (rare today)Boring cycle (dwell at bottom, spindle stops, manual return) | Cutting feed | Dwell, spindle stop | Manual |
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)
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)
Diagram: G83 motion (side view)
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)
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)
Diagram: G76 motion (side view)
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].
| Code | Type | Meaning |
|---|---|---|
| G90 | Single-type | OD/ID cutting cycle (single-type canned cycle, G-code system A) |
| G92 | Single-type | Threading cycle (single-type canned cycle, G-code system A) |
| G94 | Single-type | Facing cycle (single-type canned cycle, G-code system A) |
| G70 | Multiple-type | Finishing cycle (finishes the shape roughed out by G71–G73) |
| G71 | Multiple-type | OD/ID rough cutting cycle (cuts in the Z direction) |
| G72 | Multiple-type | Facing rough cutting cycle (cuts in the X direction) |
| G73 | Multiple-type | Closed-loop cutting cycle (pattern repeating; cuts along the blank shape, e.g., castings) |
| G74 | Multiple-type | Face grooving (cut-off) cycle / peck drilling of deep holes in Z |
| G75 | Multiple-type | OD/ID grooving (cut-off) cycle |
| G76 | Multiple-type | Multiple 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
Diagram (lathe): G76 (lathe), multiple threading cycle
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
- Forgetting G80: a canned cycle is modal, so drilling continues even at the next G00 X_ Y_
- 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
- 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
- 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
- Miscalculated F for tapping: for feed per minute, spindle speed × pitch; for feed per revolution, the pitch itself
- G76 shift direction opposite to the tool orientation: the shift cuts the finished bore
- 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
- Mitsubishi Electric, "The Basics of CNC Machining Programming (for Machining center)" e-learning material (PDF)
- Mitsubishi Electric, "The Basics of CNC Machining Programming (for Lathe)" e-learning material (PDF, BNP-C8027-688)
- Siemens AG, "SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Milling, 04.2007 Edition (6FC5398-7BP10-0BA0)"
- Siemens AG「SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition」
- Haas Automation, Inc., "Mill Operator's Manual – 17 Mill G-Codes" (online edition)
- Haas Automation, Inc., "Lathe Operator's Manual – 16 Lathe G-Codes" (online edition)
- Haas Automation, Inc., "G-code, M-code, and Setting" (explanations by code)
- National Institute of Standards and Technology (NIST), "The NIST RS274NGC Interpreter – Version 3" (NISTIR 6556, 2000)
- 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)
- 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
NewsMachine Tool Orders All but Certain to Set an Annual Record in 2026: ¥1.4461 Trillion Through August (JMTBA)
QualificationsHow to study for the Machine Maintenance Technician Grade 2 exam (mechanical): frequent topics from the past 3 years and a plan for the last 2 months
Troubleshooting