Canned cycles compress the whole drill-a-hole dance — rapid over, rapid down to clearance, feed to depth, retract — into one line per hole. After a cycle block, every following coordinate line drills another hole with the same parameters:
G90 G17 G54
G0 X10 Y10 ; over the first hole
G81 R2 Z-12 F150 ; drill it: rapid to Z2, feed to Z-12, retract
X30 ; second hole — same cycle repeats
X50 Y25 ; third
G80 ; cancel the cycle mode
The family shares the same block shape and differs in what happens at the bottom of the hole:
G81— feed to depth, rapid out. Plain drilling.G82— dwell (P, in seconds/ms per control) at the bottom, then out. Flat-bottom spots and counterbores.G83— peck: feed downQ, rapid all the way out to R to clear chips, rapid back, repeat. Deep holes.G73— high-speed peck: short chip-breaking retract instead of a full one. Faster, for materials that chip well.G84/G74— right/left tapping (spindle reverses at depth); rigid-tap variants are control-specific (LinuxCNCG33.1, Mach4G84.2/.3).G85/G89— boring: feed out instead of rapid, for finish bores.G80— cancel; the axis words go back to meaning normal moves.
| Operation | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|
| Cancel canned cycle | G80 |
— | G80 |
G80 |
G80 |
G80 |
Required to exit drill/bore/tap modes. |
| Standard drilling | G81 |
— | G81 |
G81 |
G81 |
G81 |
Z down at feed, rapid out. |
| Drilling with dwell at bottom | G82 |
— | G82 |
G82 |
G82 |
G82 |
Spot / counterbore use. |
| Peck drilling (full retract) | G83 |
— | G83 |
G83 |
G83 |
G83 |
Q = peck depth; full retract clears chips. |
| High-speed peck drilling (short retract) | G73 |
— | G73 |
G73 |
G73 |
G73 |
|
| Right-hand tapping | G84 |
— | G84 |
G84 |
G84 |
G84 |
Mach3: needs OEM plugin for rigid tap |
| Left-hand / counter tapping | G74 |
— | G74 |
G74 |
G74 |
G74 |
FANUC LATHE reassigns G74 to a face-grooving cycle — see false friends. |
| Rigid tapping | G33.1 |
— | — | — | — | G84.2 / G84.3 |
Dedicated rigid-tap codes; otherwise rigid mode is a flag on G84. LinuxCNC: LinuxCNC rigid-tap code |
| Boring (feed in, feed out) | G85 |
— | G85 |
G85 |
G85 |
G85 |
|
| Boring with dwell (feed out) | G89 |
— | G89 |
G89 |
G89 |
G89 |
|
| Return to initial Z after a cycle | G98 |
— | G98 |
G98 |
G98 |
G98 |
FANUC LATHE reassigns G98 to feed-per-minute — see the Turning group and false friends. |
| Return to R-plane after a cycle | G99 |
— | G99 |
G99 |
G99 |
G99 |
FANUC LATHE reassigns G99 to feed-per-revolution. |
— means the control has no equivalent code. Full cross-control tables: the complete G-code & M-code reference.
#R planes and retract modes
Two heights govern every cycle: the initial Z (where the tool was when
the cycle block executed) and the R plane (R word — the feed-start /
retract height just above the part). G98/G99 choose which one the tool
returns to between holes:
G0 Z25 ; initial Z: above the clamps
G99 G83 R2 Z-30 Q5 F120 ; pecks; retracts only to Z2 between holes
X40 ; fast hole-to-hole moves at Z2
G98 X70 ; this hole retracts to Z25 — clearing the clamp
G80
Watching a peck cycle in a simulator makes the R-plane logic obvious in a way no manual page does — each peck's full retract, the G99 skim moves, the one G98 hole that pops up high.
#Common mistakes
- Forgetting G80. The cycle is modal; an
Xline meant as a positioning move after the "last" hole cheerfully drills one more where it lands. - R plane below the part surface. The rapid-to-R move becomes a rapid into material. R sits just above the stock — 1–3 mm is typical.
- Q as an absolute depth. Peck increments are positive and
incremental.
Q5means 5 per peck, not "peck at Z-5". - G99 under a clamp. Retracting only to the R plane is quick until the hole-to-hole path passes under a strap clamp at Z2. Switch to G98 for holes with obstacles between them.
- Expecting cycles on GRBL. Not there — post for the target control.