Canned Cycles in CNC (G81 to G89): Drilling, Boring, and Tapping Explained
Canned cycles (G81–G89) are pre-programmed subroutines used to perform repetitive machining tasks like drilling, tapping, and boring with minimal code.
They help reduce programming time and improve readability by automating common tool movements.
🧠 What Is a Canned Cycle?
A canned cycle is a predefined sequence of movements that performs a machining operation. Once called, it executes the same operation on multiple locations.
Instead of writing multiple lines for each hole, you write one command and just change coordinates.
🧭 Standard Canned Cycle Format
G81 X... Y... Z... R... F...
| Code | Meaning |
|---|---|
| G81–G89 | Type of canned cycle |
| X, Y | Hole position |
| Z | Final depth |
| R | Retract height |
| F | Feedrate |
You can repeat the same cycle at different positions just by changing X and Y, until you cancel the cycle with G80.
📘 G-Code Canned Cycle Overview Table
| G-Code | Cycle Type | Description |
|---|---|---|
| G81 | Drilling | Simple drilling to depth at feedrate |
| G82 | Drilling with dwell | Same as G81 + pause at bottom |
| G83 | Peck drilling | Drills in steps to reduce chip buildup |
| G84 | Tapping | Rigid tapping cycle |
| G85 | Boring (no dwell) | Bores in and retracts at feed |
| G86 | Boring (spindle stop) | Spindle stops before retract |
| G87 | Back boring | Bore from backside |
| G88 | Boring with manual retract | Waits for operator action |
| G89 | Boring with dwell | Dwell at bottom before retract |
🧪 Example: Simple Drilling with G81
G90 G21 ; Absolute positioning, mm mode
G0 X10 Y10 ; Rapid to hole 1
G81 Z-10 R2 F150 ; Drill to -10, retract to 2, feedrate 150
X20 Y10 ; Drill hole 2
X30 Y10 ; Drill hole 3
G80 ; Cancel canned cycle
🛠️ G81 is modal — remains active until canceled with
G80.
⏱️ G82 – Drilling with Dwell
Use this to pause at the bottom of a hole for better finish.
G82 Z-8 R1 P500 F100 ; Dwell 500ms at bottom (P in milliseconds)
X20 Y10
X30 Y10
G80
🔁 G83 – Peck Drilling
For deep holes, G83 breaks the drilling into pecks to clear chips.
G83 Z-20 R2 Q4 F100 ; Peck every 4mm to depth -20
X10 Y10
X20 Y10
G80
| Parameter | Description |
|---|---|
| Q | Peck depth per cycle |
| Z | Total hole depth |
🔄 G84 – Tapping Cycle
Rigid tapping with synchronized spindle and feed.
G84 Z-12 R2 F0.5
X20 Y10
G80
⚠️ Requires rigid tapping capable spindle.
🧱 G85 to G89 – Boring Cycles
| G-Code | Description |
|---|---|
| G85 | Bore in/out at feedrate |
| G86 | Bore in, stop spindle, rapid out |
| G87 | Back boring from far side (rare) |
| G88 | Bore in, wait for operator (manual retract) |
| G89 | Bore in, dwell, then feed retract |
G85 Z-10 R1 F100
X10 Y10
G80
🧼 Canceling Canned Cycles – G80
Always cancel a canned cycle before any rapid move:
G80
G0 Z100
Failing to cancel may cause the machine to repeat a cycle unexpectedly.
🔒 Safety Tips
- 🛑 Always retract Z before rapid moves
- 🔁 Use
G98orG99to control retract position (initial vs R-plane) - ⚙️ Confirm your machine’s support for each cycle (some vary)
🎯 G98 vs G99: Return Level
G98 ; Return to initial Z
G99 ; Return to R-plane
| Code | Retract To |
|---|---|
| G98 | Previous Z position |
| G99 | R value |
Use G99 to keep retracts fast and efficient.
📐 Peck Drilling Visualization
|
Z=0 ---- R=2 → retract plane
|
| ← peck 1 (Q=4)
|
| ← peck 2 (Q=4)
|
| ← peck 3 ...
|
Z=-20 → final depth
🧠 Summary
| Feature | Benefit |
|---|---|
| Reusable | One cycle = many operations |
| Safer | Retract between moves |
| Compact | Less G-code to write |
| Professional | Standard practice in production |
Canned cycles are essential for efficient, clean, and safe CNC programs.
Master them once, save hours for life.
🔚 Final Thoughts
Understanding canned cycles will dramatically improve your CNC productivity. From basic drilling (G81) to advanced pecking (G83) and tapping (G84), these cycles are must-know tools for every CNC programmer.
Keep a printed reference or bookmark this guide — you’ll use it every day.
Leave a comment