← Back to CNC Programming

Drilling, Pecking & Boring

Canned drilling cycles turn five or six manual moves into one block of code. This page explains G81, G82, G83, G85, the R plane, drill-point compensation, G98/G99 retract modes, and how to choose the right cycle for each hole.

Concept

A drilling cycle is a pre-programmed sequence stored in the CNC controller. Instead of writing G00 to position, G01 down to depth, G00 back up, and repeating for every hole, you activate a cycle once and then just give new X/Y positions. The controller handles the rapid-to-feed-to-retract sequence automatically.

The basic sequence for every drilling cycle is: (1) rapid to the hole's X/Y position, (2) rapid to the R plane, (3) feed to the programmed Z depth, (4) dwell or retract as specified, (5) retract to either the R plane (G99) or the initial Z height (G98). Once activated, the cycle stays modal — every subsequent X/Y line repeats the entire drill sequence at the new position. G80 cancels the cycle.

Why It Matters

Without canned cycles, drilling a 16-hole pattern means writing 80+ blocks of code. With G83, you write one cycle line and 16 X/Y positions. More importantly, canned cycles enforce a consistent, repeatable motion: the R plane, feed rate, and retract height are the same for every hole, which prevents human error on repeated operations.

Choosing the wrong cycle has real consequences. Drilling a deep hole with G81 (no pecking) packs chips into the flutes, overheats the drill, and can snap it. Drilling around a fixture boss with G99 (retract to R plane) risks a collision with the boss. Always end a hole pattern with G80 to make the cycle stop explicitly.

How It Works

Cycle Parameters

ParameterMeaningTypical Value
X / YHole position in work coordinatese.g. X10. Y10.
RR plane: height where feed starts, above the stock1–3 mm above top surface
ZFinal hole depth (negative into the part)e.g. Z-15.
FFeed rate under G21/G94, mm/minper tooling chart; mm/rev uses fn notation
QPeck increment (used by G73/G83 in this page)1–3 mm per peck, per tool maker
PDwell time at bottom (cycles that support it, e.g. G82)e.g. P0.5 = 0.5 s; confirm decimal convention
G98Retract to initial Z plane after each holeuse around fixtures/bosses
G99Retract only to R plane after each holeuse for flat patterns

The R Plane: Your Safety Buffer

The R plane is the Z height where rapid motion switches to feed motion. It must be high enough above the stock that rapid XY moves between holes clear clamps, bosses, and chips. Set R based on the actual setup, not a default number; R = 2–3 mm above the top surface is a starting point, verified against the real obstructions. G98 retracts to the initial plane established before the cycle call (not automatically Z50); use it when a boss or clamp sits between holes.

stock Initial plane Z50 R plane Z2 Top surface Z0 Z depth Z-15 (tip) G00 rapid G01 feed
Drilling cycle motion (schematic, not to scale): rapid from initial plane to R plane, then feed to Z depth. The final Z line is the commanded tip position. G98 retracts to the established initial plane; G99 retracts only to R.

G81 — Simple Drilling

G81 is the basic drill cycle: rapid to R, feed to Z, rapid retract. No dwell at the bottom. Use it for through-holes in thin-to-medium plate, spot centering, and any hole where the drill does not need time at the bottom. It is the fastest drilling cycle but does not clean up the hole bottom.

G82 — Drilling with Dwell

G82 adds a dwell (pause) at the bottom of the hole before retracting. The dwell time is set with P. A dwell does not change the drill geometry: a pointed twist drill still leaves a conical bottom. The dwell improves surface finish and size consistency at the bottom and helps on counterboring, but a flat bottom requires a flat-bottom drill or a spot-facing/ counterboring tool. Typical dwell: P0.2–P0.5 seconds (decimal seconds on Haas; confirm the control's P convention).

G83 — Peck Drilling (Chip Breaking)

G83 is used when chip evacuation is difficult, for example in deep holes or long-chipping materials. Instead of feeding all the way to depth in one motion, the drill feeds in increments of Q, retracts fully to break and clear chips, then re-approaches and feeds the next Q increment. Each peck lifts chips out of the hole so they do not pack in the flutes. Q is chosen from the drill manufacturer's guidance based on diameter, coolant, and material rather than a fixed depth-to-diameter threshold.

Example: G83 R2. Z-30. Q3. F100. means: feed 3 mm, retract to R, feed 3 mm deeper, retract, repeat until reaching Z-30. This keeps chips clear by bringing them out of the hole between pecks.

G85 — Boring

G85 bores or reams a hole: feed in to Z depth, then feed back out at the same feed rate. Unlike drilling (which retracts at rapid), G85's controlled feed-out produces a smoother bore surface. For a boring bar, the bore diameter is set by the bar's radial screw adjustment; for a reamer, by the reamer's effective diameter and the cutting conditions.

Drill Point Compensation

A standard twist drill has a conical tip. The full-diameter cutting edge reaches the corners first; the center point extends beyond by h = (D/2)/tan(α/2). For a 118° drill this is about 0.300D. For a through-hole, the tip must pass the back face by at least h plus a deliberate breakthrough allowance; the failure mode is that the full-diameter edge has not yet broken through, not a center nub. For a 10 mm, 118° drill, h ≈ 3.0 mm.

12 mm plate 12 mm h=3 mm tip Z = -(12 + 3.004) ≈ -15.004 (118°)
Drill point geometry at 5 px/mm: shoulder at plate bottom y90, tip h≈3 mm below. Through-holes add a deliberate breakthrough allowance; blind holes set tip Z per the drawing's depth convention.

Example

Worked example: Two Ø8 mm through-holes in a 10 mm aluminum plate. Hole 1 at X10 Y10, Hole 2 at X50 Y30. R plane = Z2. With a 118° drill, tip length h ≈ 0.3004 × 8 = 2.4 mm; program Z depth to break through by at least this, plus a small allowance, e.g. Z-12.5. Peck drilling Q2. No obstructions between holes, so G99 retract to R plane saves time.

O0017 (DRILLING CYCLE EXAMPLE)
G21 G17 G90 G94 G40 G80
G54
T01 M06                 (Ø8 HSS DRILL)
S1500 M03
G00 G43 H01 Z50. M08   (safe Z first, with tool length)
X10. Y10.               (then XY to hole 1)
G99 G83 R2. Z-12.5 Q2. F120.   (first hole, retract to R)
X50. Y30.                      (second hole, same cycle)
G80
G00 Z50.
M09
M05
M30

What happens line by line: after tool change, the machine goes to safe Z50 with H01 before XY moves. Then it moves to (10,10), rapid to Z2, feeds down in 2 mm pecks to Z-12.5, retracts to R2 (G99). Then XY to (50,30) at R2 and repeats. G80 cancels. Z50 retract, then coolant off and spindle off. The program uses G99 because there are no clamps between the holes; if a boss sat between them, G98 would be required. R2 and the initial plane Z50 are validated against the actual setup before running.

G84 — Tapping

G84 is the tapping cycle: the spindle feeds down at the tapped RPM, reverses at the bottom, and feeds back up. Feed in mm/min equals spindle speed × pitch. For a classroom example: S500 RPM, pitch 1.25 mm, F = 500 × 1.25 = 625 mm/min. The return feed may be governed by a control setting and is not always identical to the down-feed. Use G84 only with a rigid-tapping spindle or a compensated tap holder. This program explicitly sets G21/G94; do not assume the cycle sets feed mode for you.

G73 vs G83: Chip Break vs Full Retract

G73 is a high-speed peck cycle: it feeds in Q increments but retracts only a small amount (a few mm) between pecks, not all the way to R. This saves time for chips that break easily (short-chipping materials like cast iron). G83 retracts fully to R after every peck, clearing chips completely. For long-chipping steel, use G83; for cast iron or aluminum, G73 may be faster. Choose between G73 and G83 based on the drill design, depth-to-diameter ratio, through-spindle coolant, and material chip characteristics; match the tool maker's recommendation rather than assuming one cycle is always safer.

Multiple Tools and Hole Patterns

After a tool change, re-establish safe Z, G43 Hxx, and coolant before calling the next cycle. The cycle parameters (R, Z, Q, F) reset or carry over depending on the control; safest practice is to re-specify them on the first hole of each new tool. For a bolt circle or rectangular pattern, list the X/Y positions as consecutive lines after the cycle call; do not repeat G83 on each line.

When to Use G98 vs G99

G99 retracts to R plane and is faster, but only safe when the tool can stay at R between holes without hitting anything. If there is a clamp, a raised boss, a vise jaw, or a previously drilled tall part between holes, use G98 to retract to initial Z50. It is common to mix: start a pattern with G99, switch to G98 for the row that crosses a fixture, then back to G99.

Coolant and Chip Evacuation

Drilling generates heat and chips. Flood coolant through the spindle (or through the tool for deep holes) pushes chips out the flutes. In deep-hole pecking, the retract lets chips fall into the flutes and coolant flush them out. Without coolant, the drill tip temperature climbs rapidly and wear accelerates. M08 must be on before the cycle; M09 after G80.

Through-Hole vs Blind-Hole Depth

A twist drill's conical tip extends past the full-diameter cutting edge by h = (D/2) / tan(α/2), where α is the included point angle. For a 118° general-purpose drill, h ≈ 0.3004 D; for a 135° drill, h ≈ 0.2071 D. The 0.3D rule is a 118° approximation, not a universal constant. For a through-hole, the tip must pass the back face by at least h plus a deliberate breakthrough allowance, and the area below the part must clear chips. For a blind hole, if tool length is set from the drill tip, Z is the tip position. If the drawing calls for a full-diameter depth D_full (positive into the part, Z0 at top surface, +Z up), program the tip at Z = −(D_full + h). Example: Ø10, 118°, D_full = 12 mm, h ≈ 3.004 mm, tip Z ≈ −15.004. If the drawing instead specifies tip depth 12, program Z = −12. Check remaining wall thickness for blind holes and clearance below through-holes.

Spot Drilling vs Center Drilling

Center drills primarily produce the 60° center hole used for lathe centers. Spot drills are used to start a hole accurately and reduce wander on the drill that follows. Whether to spot-drill, and what included angle to use, depends on the twist drill's point geometry and the tool maker's recommendation; angle matching is not a universal rule. A dwell in G82 does not turn a pointed drill into a flat-bottom tool — flat bottom comes from a spot-facing or counterboring cutter.

Cycle Modal State and G80

Once a cycle is called, it stays modal. A bare position block like X50. Y30. repeats the cycle at the new X/Y. On Haas, an explicit G00 X50. Y30. cancels the cycle and moves at rapid. The safest practice is still to write G80 explicitly after the hole pattern, so the cycle stop does not depend on which G-code happens to appear on the next line.

Drill Size and Surface Speed

Drilling RPM follows the same surface speed rule as milling: n = 1000×vc / (π×D). A Ø10 drill in aluminum at vc = 100 m/min runs at about 3180 RPM. Feed per revolution fn = 0.1–0.2 mm/rev in steel, higher in aluminum. The cycle's F under G94 is mm/min = n × fn. These are classroom assumptions; match your tooling chart.

Verification Before Running the Cycle

After writing the hole pattern, verify on the controller's graphics or single-block run: confirm each X/Y position, confirm R plane clearance, confirm G80 at the end. The exact single-block behavior at R depends on the control; check it on your machine rather than assuming a universal pause. Never assume the pattern is correct just because the numbers look neat.

Common Mistakes

Practice

1. Through-hole in 15 mm plate, Ø12 drill, 118° point. What Z depth?

Ans

Tip length h = (12/2)/tan(59°) = 6/1.664 = 3.61 mm. Program tip to at least Z-(15+3.61)=Z-18.61, plus a deliberate breakthrough allowance and check the clearance below the part. Do not round shallower.

2. When do you use G83 instead of G81?

Ans

When chips pack in the flutes and evacuation becomes difficult. G83 pecks in Q increments and retracts fully between pecks so chips leave the hole.

3. What is the difference between G98 and G99?

Ans

G98 retracts to the initial Z plane (the height before the cycle was called). G99 retracts only to the R plane. G99 is faster for flat patterns; G98 is safer around fixtures.

4. Write a G82 line for a spot face that dwells 0.5 seconds at Z-2, R2, F100.

Ans

G82 R2. Z-2. P0.5 F100. (P0.5 = 0.5 seconds; confirm the control's P decimal convention. A dwell does not flatten a pointed drill bottom.)

Sources