G54.APP

G-code deep dive

G81, G82, G83: Drilling Canned Cycles Explained

G80G81G82G83G73G84G74G85G89G98G99

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:

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4Notes
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

Frequently asked questions

What is the difference between G81 and G83?

G81 plunges to depth in one continuous feed — right for shallow holes. G83 pecks: it drills a Q-depth increment, retracts fully to the R plane to clear chips, and re-enters, repeating to depth. Use G83 when the hole is deeper than roughly 3–4 tool diameters.

What do R, Z and Q mean in a drilling cycle?

R is the retract plane — the height the tool rapids to before feeding, and returns to between pecks. Z is the final hole depth. Q is the peck increment for G73/G83, always given as a positive incremental distance.

What is the difference between G98 and G99?

They set where the tool retracts after each hole (on a mill): G98 returns to the initial Z — the height before the cycle started — while G99 returns only to the R plane. G99 is faster between holes on a flat part; G98 clears clamps and steps. Warning: on a FANUC lathe, G98/G99 mean feed-per-minute/per-revolution instead.

Why doesn't G81 work on my GRBL machine?

GRBL has no canned cycles at all. CAM posts for GRBL expand each hole into explicit G0/G1 moves. If a file full of G81s runs strangely on GRBL, it was posted for the wrong control.

See it, don't guess it

Paste a program into the free G54.APP viewer and watch these codes execute — toolpaths, stock removal, and machine state, live in your browser. Nothing is uploaded.

Open the G-code viewer