Canned Cycles (Drilling, Tapping, Boring)
A canned cycle (Fanuc calls it a fixed cycle) collapses a whole drill-in-and-out sequence — rapid to the hole, feed to depth, dwell or reverse, retract — into a single block. Better still, the cycle is modal: once it is active, every following block that only carries an X/Y position drills another hole with the same parameters, until you cancel with G80. Peter Smid puts it plainly — fixed cycles “are special purpose macros that Fanuc provides as a standard programming feature (built-in). We call these macros by an established G-code, for example, by G81 command for the standard drilling cycle.”
What a Canned Cycle Replaces
Without a cycle, one hole is four blocks — and every extra hole repeats three of them:
(LONGHAND - one hole)
G00 X10. Y10. (rapid over the hole)
G00 Z2. (rapid to the clearance plane)
G01 Z-15. F150. (feed to depth)
G00 Z25. (rapid out)
(CANNED CYCLE - same hole, plus two more for free)
G99 G81 X10. Y10. Z-15. R2. F150. (drill, return to R plane)
X30. (next hole - one word)
X50. (next hole - one word)
G80 (cancel the cycle)
The G81 block defines the drilling motion once. Each bare X/Y after it re-runs that motion at the new position. G80 turns the cycle off — forget it and the very next positioning move will plunge a hole where you did not want one.
The Common Address Words
Every hole-making cycle draws from the same small vocabulary. Learn these once and every cycle in the table below reads the same way.
| Address | Meaning | Notes |
|---|---|---|
G98 | Return to the initial plane after each hole | The Z height the tool was at when the cycle started. Use to clear clamps/steps between holes. Modal. |
G99 | Return to the R plane after each hole | The default and the fast choice — tool only retracts to R, not all the way up. Modal. |
R | Rapid / retract plane | Z height where rapid ends and feed begins — a few mm above the surface. Feed motion starts here. |
Z | Final hole depth | The bottom of the hole (absolute in G90, or incremental from the R plane in G91). |
Q | Peck increment / shift amount | Depth of each peck in G73/G83; tool shift-away distance in G76/G87. Always a positive value. |
P | Dwell at the bottom | Used by G82/G89 (and others). Units are milliseconds on most Fanuc controls — P1000 = 1 second. |
F | Feedrate | Cutting feed. For tapping this is not free — it must equal pitch × rpm (see below). |
K (or L) | Repeat count | Number of times to repeat the cycle, used with G91 incremental positioning to drill an equally-spaced row. K0 positions without drilling. Fanuc uses K; some controls use L. |
The figure below puts those words on the machine — every hole-making cycle is some variation of this one picture.
Anatomy of a drilling cycle: rapid to R, feed to Z, then retract — G99 returns only to the R plane, G98 all the way back to the initial plane.
The Fanuc / ISO Canned-Cycle Set (G73-G89)
This is the payload — the cycles a programmer reaches for daily. What distinguishes them is the bottom-of-hole behavior: whether the tool dwells, reverses the spindle, stops it, or shifts away before retracting. Get that right and you pick the correct cycle every time.
| Cycle | Purpose | At the bottom | Retract |
|---|---|---|---|
| Drilling & pecking | |||
G81 | Standard drilling / spot drilling | Nothing — reaches Z and reverses | Rapid to R (G99) or initial (G98) |
G82 | Drill with dwell — counterbore, spotface, flat-bottom holes | Dwell P to clean up the bottom | Rapid out |
G83 | Peck drilling for deep holes — full chip clearing | Reached in Q-sized pecks; retracts fully to R between pecks to eject chips | Rapid out |
G73 | High-speed peck drilling — chip breaking, faster | Reached in Q-sized pecks; retracts only a small clearance (param #5114) between pecks, not to R | Rapid out |
| Tapping | |||
G84 | Right-hand tapping | Spindle reverses (CW→CCW) | Feeds back out while reversed, then spindle restores |
G74 | Left-hand tapping | Spindle reverses (CCW→CW) | Feeds back out while reversed |
| Boring & reaming | |||
G85 | Boring / reaming — clean wall both ways | Nothing; spindle keeps turning | Feeds back out (no drag mark, but slow) |
G86 | Boring | Spindle stops | Rapid out — may leave a drag line on the wall |
G76 | Fine boring — precision, no drag mark | Oriented spindle stop, then tool shifts away from the wall by Q | Rapid out clear of the bore |
G87 | Back boring (bore the underside of a hole) | Oriented stop & shift, feed up, then bore; shift back and retract | Complex — tool works upward from below |
G88 | Boring with dwell & manual retract | Dwell P, spindle stops; operator may retract by hand in feed hold | Rapid out after cycle start is pressed |
G89 | Boring with dwell — like G85 with a cleanup pause | Dwell P, spindle keeps turning | Feeds back out |
| Cancel | |||
G80 | Cancel the active canned cycle | — | Clears all cycle data; the next block is a plain move again |
Quick way to remember the boring family: G85/G89 feed out (best finish, slowest); G86 stops and rapids out (fast, may mark the wall); G76 orients and shifts away (best of both — needs a spindle-orient-capable machine and a single-point boring bar).
Rigid Tapping (G84 with M29)
Ordinary G84/G74 tapping assumes a tension-compression (floating) tap holder to absorb the small mismatch between spindle rotation and Z feed. Rigid tapping removes the float: the control electronically synchronizes spindle angle to Z position so one revolution advances exactly one thread pitch. On most Fanuc and Fanuc-style controls you enter rigid mode with M29 S____ in the block before the cycle (Haas and many others accept the same convention; some machines enable it by parameter or a dedicated M-code instead).
M29 S500 (enter rigid tapping, 500 rpm)
G99 G84 X10. Y10. Z-20. R5. F625. (rigid tap - see feed math below)
The one rule you cannot break: tapping feed must equal pitch × rpm. For an M8×1.25 tap at 500 rpm, F = 1.25 × 500 = 625 mm/min. Get it wrong and you snap the tap or strip the thread. Controls that support feed-per-revolution (G95) let you sidestep the arithmetic by programming F as the pitch directly (F1.25).
Worked Examples
1. Drilling several holes — G81 with G99 and G98
Four holes. The first three return to the R plane (fast). The fourth switches to G98 to lift over a clamp before moving on.
G90 G54 G00 X0 Y0 (absolute, work offset, safe XY start)
G43 Z25. H01 S1200 M03 (tool length comp, initial plane, spindle CW)
G99 G81 X10. Y10. Z-15. R2. F150. (hole 1 - drill, return to R plane)
X30. (hole 2)
X50. (hole 3)
G98 Y30. (hole 4 - return to initial plane to clear a clamp)
G80 (cancel cycle)
G00 Z25. M05 (retract, spindle off)
2. Deep hole — G83 peck drilling with Q
A 40 mm-deep hole cleared in 6 mm pecks. After each peck the drill retracts fully to the R plane to eject chips, then rapids back down to just above the last depth before feeding again.
G90 G54 G00 X0 Y0
G43 Z25. H02 S900 M03
G99 G83 X10. Y10. Z-40. R2. Q6. F120. (peck drill, 6mm per peck)
X30. (second deep hole, same pecks)
G80
G00 Z25. M05
3. Tapping — G84 (rigid)
M8×1.25 taps at two locations. Note the feed is computed from pitch × rpm, and M29 puts the spindle in rigid mode first.
G90 G54 G00 X0 Y0
G43 Z25. H03 S500 M03
M29 S500 (rigid tapping mode)
G99 G84 X10. Y10. Z-20. R5. F625. (F = 1.25 x 500 = 625 mm/min)
X30.
G80
G00 Z25. M05
The Same Cycles on Other Controls
The G-code fixed-cycle set is remarkably portable. EIA/ISO controls share it almost verbatim; Siemens and Heidenhain use named cycles that map one-for-one onto the same operations. Keep the mapping high-level — always confirm dwell units and retract behavior against the specific machine’s manual.
| Operation | Fanuc / Haas / Mazak-EIA / Mitsubishi | Siemens SINUMERIK | Heidenhain (Klartext) |
|---|---|---|---|
| Drill | G81 | CYCLE81 | CYCL DEF 200 |
| Drill + dwell / counterbore | G82 | CYCLE82 | CYCL DEF 200 (dwell param) |
| Deep-hole peck | G83 / G73 | CYCLE83 | CYCL DEF 203 / 205 |
| Rigid / synchronized tap | G84 (M29) | CYCLE84 | CYCL DEF 207 |
| Tap, floating holder | G84 (no M29) | CYCLE840 | CYCL DEF 206 |
| Bore / ream (feed out) | G85 | CYCLE85 | CYCL DEF 201 / 202 |
| Cancel cycle | G80 | MCALL (empty) | ends at next CYCL CALL / block |
Minor differences to watch for: dwell P is milliseconds on Fanuc but often seconds elsewhere; repeat count is K on Fanuc and L on some controls; a few machines auto-detect rigid tapping without M29. On Siemens, a cycle becomes modal (repeats at each position) only when you wrap it with MCALL CYCLE8x(…) and turn it off with a bare MCALL — the direct equivalent of the Fanuc G80. For the Siemens programming model see SINUMERIK Programming Basics; for Heidenhain Klartext conventions see Heidenhain TNC 640 Klartext & Q-Parameters.
Canned Cycles vs. Custom Macros
A canned cycle is a built-in macro Fanuc ships behind a reserved G-code. When the built-in set does not cover what you need — a different feed on retract than on plunge, a probing move, an odd chamfer — you write your own with a custom G/M cycle (parameters 6050–6059 map G100-style codes to your O9010-O9019 programs). Smid frames the two as the same species: the standard cycles are “special purpose macros that Fanuc provides,” and a custom cycle just gives your own macro “the look and feel of a true cycle.”
The two work together. A bolt-hole-circle macro does the geometry — it computes each hole’s X/Y from the circle diameter, center, count, and start angle (X = cos((n-1)·B + A)·R + Xc) — and then calls a canned cycle at every computed position. The macro handles where; the canned cycle handles how deep and how. That layering is the heart of parametric programming: one verified macro drives a standard cycle across dozens of holes.
Common Gotchas
| Trap | What goes wrong | Fix |
|---|---|---|
Forgetting G80 | The cycle stays modal — the next positioning move (even a tool-change approach or a rapid across the part) drills a hole. Crash / scrap risk. | Cancel with G80 the moment the last hole is drilled, before any other motion. |
| R plane vs. initial plane over clamps | Under G99 the tool only lifts to R — if a clamp or a raised boss sits between holes, the tool plows into it. | Switch to G98 for holes whose travel crosses an obstruction; return to G99 after. |
| Wrong return mode left active | G98/G99 are modal and carry over from an earlier cycle, so a hole retracts to an unexpected height. | State the return mode explicitly on the first cycle block of each operation. |
Peck Q too large | The drill packs chips instead of clearing them — heat, poor finish, or a broken drill in deep or gummy material. | Keep Q around 0.5–1× the drill diameter; reduce for stainless/aluminum. Use G83 (full retract), not G73, for the deepest holes. |
| Tapping feed not equal to pitch × rpm | Snapped tap or stripped thread — the tap advances at the wrong rate relative to spindle turns. | Always compute F = pitch × rpm (or program the pitch as feed-per-rev in G95). |
| Depth sign / reference confusion | In G91 the Z and R values are incremental from the current level, not absolute — easy to double or halve a depth. | Know whether you are in G90 or G91 before writing Z/R; most shops keep hole cycles in G90. |
See also: Custom G/M Cycles for rolling your own cycle, Parametric Programming for the bolt-circle math that feeds a canned cycle, and SINUMERIK Programming Basics for the Siemens CYCLE8x family.
▶ Open the Macro Playground — drive canned cycles from a bolt-circle macro and watch the positions compute.
References
- Peter Smid, Fanuc CNC Custom Macros, Industrial Press, 2005 (Chapter 21, Custom Cycles; Chapter 20, Bolt Hole Circle Pattern).
- Fanuc, Operator’s Manual (Machining Center) — canned cycles for drilling G73–G89, FANUC Corporation.
Have a question or want to contribute?
Contact us with corrections, additions, or topics you'd like covered.
Get in Touch