Drilling Canned Cycles G73–G89: G81, G83, G84 and Boring Cycles on Fanuc Mills
Updated
Drilling canned cycles (G73–G89) are Fanuc-style milling commands that perform a complete hole operation in one block: G81 simple drilling, G83 deep-hole peck drilling, G84 tapping, and G85–G89 and G76 boring. The block gives X, Y, hole bottom Z, R plane, peck depth Q, dwell P and feed F; G98 returns the tool to the initial level, G99 to the R plane, and G80 cancels the cycle.
Drilling canned cycles are subroutines built into the CNC control that perform a complete hole-making sequence in a single block: rapid positioning over the hole, rapid down to the R plane, feeding to depth, dwell, spindle reversal or stop, and retract. On Fanuc-style milling controls they are programmed with G73–G89 and cancelled with G80. A cycle is modal: until it is cancelled, every following block with new X and Y coordinates machines another hole. The logic below follows Fanuc; general syntax is covered in G-code basics.
Cycle block format
General form: G90/G91 G98/G99 G8x X_ Y_ Z_ R_ Q_ P_ F_ K_. Not every address applies to every cycle – Q is used only in G73, G83, G76 and G87, and P only in cycles with a dwell.
| Address | Meaning |
|---|---|
| X, Y | Hole position, reached at rapid traverse |
| Z | Hole bottom. In G90 an absolute coordinate, in G91 the distance from the R plane |
| R | R plane – the height down to which the tool rapids and where feed begins. In G91 the distance from the initial level |
| Q | G73 and G83: depth of each peck; G76 and G87: shift away from the bore wall after spindle orientation. Always positive |
| P | Dwell at the bottom. On Fanuc in milliseconds without a decimal point: P500 = 0.5 s |
| F | Feed rate: mm/min in G94, mm/rev in G95 |
| K (L on some controls) | Number of repeats, mostly with G91 for equally spaced holes. On Fanuc, K0 stores the cycle data without drilling |
G98 and G99 – return level
The initial level is the Z height of the tool when the cycle is called. With G98 the tool returns to the initial level after each hole; with G99 it returns only to the R plane. G99 shortens non-cutting moves between holes, while G98 is needed when clamps, bolts or higher steps of the part lie between holes. The two can be switched from hole to hole within the same cycle. G80 cancels the cycle; group 01 codes (G00, G01, G02, G03) also cancel it, but G80 is always written for clarity and safety.
Cycle overview
| Code | Name | Motion | Typical use |
|---|---|---|---|
| G73 | High-speed peck drilling | Pecks of Q with a small retract after each (set by parameter) | Chip breaking in ductile materials, medium-depth holes |
| G74 | Left-hand tapping | Feed in with spindle counter-clockwise, reverse at bottom, feed out | Left-hand threads |
| G76 | Fine boring | Feed to bottom, oriented spindle stop, shift Q away from the wall, rapid out | Precision bores without a retract mark |
| G80 | Cancel | – | After every group of cycles |
| G81 | Drilling | Feed to Z, rapid out | Spot drilling, shallow holes |
| G82 | Drilling with dwell | As G81 with dwell P at the bottom | Counterbores, countersinks, spot faces |
| G83 | Deep-hole peck drilling | After each peck Q, full retract to R, rapid back down to just above the previous depth | Deep holes where chips do not evacuate easily |
| G84 | Right-hand tapping | Feed in with M03, spindle reverses at bottom, feed out | Tapping |
| G85 | Boring | Feed in, feed out | Reaming, boring |
| G86 | Boring, spindle stop | Feed to bottom, spindle stops, rapid out | Rough boring |
| G87 | Back boring | Orient and shift, rapid down through the bore, shift back, feed up to Z | Counterbore or shoulder on the underside |
| G88 | Boring, manual retract | Feed, dwell, spindle stop, tool withdrawn in manual mode | Special cases |
| G89 | Boring with dwell | Feed in, dwell P, feed out | Blind bores with a flat bottom |
In G76 and G87 the shift direction is set by a machine parameter, so the cutting edge must face opposite to the shift when the spindle is oriented. G87 is used with G98 only, because the R plane lies below the part. See boring bars and reamers for the tooling side.
Example: four holes with G81
O2001N10 G17 G21 G40 G49 G80 G90N20 T2 M06 (DRILL 6.8)N30 G54 G00 X10.0 Y10.0 S1400 M03N40 G43 H02 Z25.0 M08N50 G99 G81 X10.0 Y10.0 Z-18.0 R2.0 F140N60 X50.0N70 Y40.0N80 G98 X10.0N90 G80N100 G00 Z100.0 M09
The drill is positioned over the first hole; G99 keeps it at the R plane (2 mm above the surface) between holes, and on the last hole G98 sends it back to the initial level of Z25. Z is the depth of the drill tip: the point of a 118° drill is about 0.3×D long, so add this when the full diameter must reach a given depth (see twist drills).
Example: deep hole with G83
N200 T4 M06N210 G54 G00 X30.0 Y20.0 S1600 M03N220 G43 H04 Z25.0 M08N230 G98 G83 X30.0 Y20.0 Z-45.0 R2.0 Q5.0 F120N240 G80
A Ø6 mm hole 45 mm deep is drilled in 5 mm pecks; after each peck the drill retracts to the R plane to clear chips and let coolant in. If chips only need breaking rather than clearing, G73 is faster.
Example: rigid tapping M8×1.25
N300 T3 M06 (TAP M8X1.25)N310 G54 G00 X10.0 Y10.0N320 G43 H03 Z25.0 M08N330 M29 S500N340 G99 G84 X10.0 Y10.0 Z-15.0 R5.0 F625N350 X50.0N360 Y40.0N370 G98 X10.0N380 G80
On Fanuc controls rigid (synchronised) tapping is activated with M29 S.. before G84 (see M-codes). In G94 the feed is F = S × pitch: 500 × 1.25 = 625 mm/min; in G95 it would simply be F1.25. The hole is pre-drilled at 6.8 mm (see tap drill sizes and metric threads). Feed and speed overrides are normally ignored during tapping and feed hold takes effect only at the end of the cycle. With a floating (compensating) tap holder, M29 is omitted and the spindle is started with M03 before the cycle. Tap types are covered in taps.
Practical tips
- Set the R plane 2–5 mm above the surface, more on uneven, cast or sawn surfaces. For tapping allow extra distance so the spindle can synchronise.
- A starting peck Q for G83 and G73 is about 0.5–1×D, reduced for ductile materials and deeper holes. Treat it as a starting value; the drill manufacturer's data takes priority.
- Check that the G98 initial level clears clamps and other obstacles; use G99 only where the path between holes is genuinely free.
- Spot drill holes before drilling with a short spot drill in G81 or G82 (see spot and centre drills).
- Calculate speed and feed for the tool and material (cutting speed and rpm).
- Always close a cycle with G80, and prove out a new program in single block with reduced rapid override.
Differences between controls
Haas, Mazak and other controls use similar codes, but the repeat address (K or L), dwell units, retract amounts and extra parameters may differ. Siemens controls program drilling with CYCLE81–CYCLE89 (tapping with CYCLE84 and CYCLE840), and Heidenhain uses its own CYCL DEF cycles. Lathe cycles are covered in Fanuc lathe cycles G70–G76. The programming manual of the specific machine is always the authoritative source. CNC programming services can be found or requested on the CNC Pasaulis marketplace.
Frequently asked questions
What is the difference between G81 and G83?
G81 drills the hole in one feed move and rapids out. G83 drills in pecks of Q and retracts to the R plane after each to clear chips, so it is used for deep holes.
What is the difference between G98 and G99?
G98 returns the tool to the initial level from which the cycle was called after each hole, while G99 returns it only to the R plane. G98 is used when obstacles lie between holes.
How do I calculate the feed for G84 tapping?
In G94, F = S × pitch; for an M8×1.25 tap at 500 rpm, F = 625 mm/min. In G95 the feed equals the pitch, i.e. F1.25.
What does P500 mean in a drilling cycle?
On Fanuc controls P is the dwell at the bottom in milliseconds without a decimal point, so P500 means 0.5 s. Other controls may use different units.
Why is M29 used before G84?
On Fanuc controls M29 with an S value activates rigid tapping, in which spindle rotation is synchronised with the Z axis. It is not used with a floating tap holder.
Do G81–G89 work on Siemens controls?
Siemens controls use CYCLE81–CYCLE89 for drilling (CYCLE84 and CYCLE840 for tapping), although some models offer an ISO dialect mode. Check the machine manual.
Looking for someone to do this job? Find a manufacturer on the marketplace or post a request.
Services offered I need a service