G-Code Canned Cycles Explained: G81–G89 Drilling, Boring, and Tapping
Canned cycles are pre-programmed routines that simplify repetitive operations like drilling, tapping, boring, and countersinking. They reduce code length, increase readability, and improve machine efficiency.
This guide covers all major canned cycles from G81 to G89, including real-world examples and best practices.
🧠 What Are Canned Cycles?
A canned cycle is a shorthand G-code block that instructs the machine to perform a predefined motion — usually vertical (Z-axis) — with parameters such as:
- R = Retract height
- Z = Final depth
- F = Feedrate
- P = Dwell time (optional)
Once activated, the cycle continues for each new X/Y coordinate until canceled with G80.
🧪 Common Canned Cycles
🔹 G81 – Simple Drilling
A basic drilling cycle: rapid to R height, feed to Z depth, retract to R.
G90 G98 G81 X20 Y30 Z-15 R2 F100
- Ideal for shallow holes
- Does not dwell
- G98 = retract to initial Z, G99 = retract to R-plane
🔸 G82 – Drilling with Dwell
Same as G81 but adds a dwell at the bottom of the hole.
G82 X40 Y30 Z-10 R2 P300 F120
P300= dwell time in milliseconds (0.3 sec)- Useful for precise holes in tough materials
🔹 G83 – Peck Drilling
Used for deep holes to break chips and avoid jamming.
G83 X50 Y50 Z-30 R2 Q5 F90
Q= peck depth (e.g., 5 mm)- Z moves in increments until full depth
- Chip evacuation improves hole quality
🔸 G84 – Tapping (Right-Hand)
Performs synchronized tapping (requires rigid tapping support).
G84 X60 Y40 Z-15 R2 F75
- Feedrate must match pitch (e.g., 1.5mm thread = 75mm/min at 50 RPM)
- Spindle reverses automatically
🔹 G85 – Boring (No Dwell)
Similar to G81 but used for boring bars or reaming tools. Feeds in and out at same feedrate.
G85 X10 Y60 Z-20 R2 F120
- No rapid retract
- Good for finishing internal diameters
🔸 G86 – Boring with Spindle Stop
Like G85 but stops spindle at bottom before retracting.
G86 X30 Y60 Z-25 R2 F100
- Spindle must restart manually
- Used for sensitive boring tools
🔹 G87 – Back Boring (Less Common)
Used with special boring tools that open behind the hole. Requires careful setup.
🔸 G88 – Boring with Manual Retract
After feed to Z, machine waits for operator input to retract.
🔹 G89 – Boring with Dwell
Same as G85 but includes dwell at bottom.
G89 X25 Y25 Z-10 R2 P500 F90
🛑 Canceling a Canned Cycle: G80
Always cancel a canned cycle before other motion commands.
G80
📊 Canned Cycle Quick Reference
| Code | Operation | Dwell | Retract | Notes |
|---|---|---|---|---|
| G81 | Drilling | No | Rapid | Most basic cycle |
| G82 | Drill + Dwell | Yes | Rapid | Precision holes |
| G83 | Peck Drilling | No | Rapid | Deep holes, chip breaking |
| G84 | Tapping (RH) | No | Rapid | Needs rigid tapping support |
| G85 | Boring | No | Feed | No rapid out, smooth retract |
| G86 | Boring + Stop | No | Feed | Spindle stop, manual restart |
| G87 | Back Boring | — | — | Special tool, custom setups |
| G88 | Manual Retract | No | — | Operator-driven retraction |
| G89 | Boring + Dwell | Yes | Feed | Finishing bores |
🧠 G98 vs G99: Retract Behavior
- G98: Return to initial Z (safe height)
- G99: Return to R plane (faster for multiple holes)
📌 Example:
G98 G81 X10 Y10 Z-15 R2 F100 ; Retract to Z before hole
G99 G81 X20 Y10 Z-15 R2 F100 ; Retract only to R = 2
🧠 CAM vs Manual Coding
- CAM software usually outputs canned cycles automatically
- You can edit manually for optimization
- For manual programming or fine tuning, understanding canned cycles is essential
✅ Best Practices
- Use
G80before tool change or mode switch - Double-check feedrates and retract heights
- Test with air cutting when using G83/G84
- Use G98 for safety, G99 for speed
🔚 Final Thoughts
Canned cycles are time-saving tools in CNC programming that:
- Reduce code clutter
- Standardize repetitive drilling and boring
- Allow faster programming of hole patterns
Master them once, and you’ll unlock cleaner, safer, and faster CNC workflows.
Leave a comment