G-Code Reference for Deep Hole Drilling Cycles — G73, G83, and Custom Macros

Complete G-code reference for deep hole drilling cycles on Fanuc and Haas controls. G73 chip breaking, G83 peck drilling with standard and progressive peck options, custom macro programming, peck strategy by L/D ratio, and coolant M-code reference.

Deep Hole DrillingReference7 min read

G83 — Deep Hole Peck Drilling Cycle (Full Retract)

G83 fully retracts to the R-plane after each peck, allowing complete chip clearance and coolant access to the cutting zone. This is the standard cycle for deep hole drilling on machining centers when using twist drills or interchangeable insert drills.

Format (Fanuc / Haas Standard)

G83 X_ Y_ Z_ R_ Q_ F_ ;
Code Meaning
X, Y Hole position
Z Final depth (from R-plane)
R Retract plane (rapid height)
Q Peck depth per increment (modal)
F Feed rate

Example — Standard Peck Drilling

G90 G00 G54 X50 Y25 ;
G43 Z10 H01 M08 ;
G99 G83 Z-40 R2 Q8 F120 ;
G80 ;

Drills at X50 Y25 to Z-40 in 8 mm pecks, retracting to R2 after each peck.

Haas I-J-K Progressive Peck Option

Haas controls support variable peck depth within G83:

G83 X_ Y_ Z_ I_ J_ K_ R_ F_ ;
Code Meaning
I First peck depth (largest)
J Reduction per pass
K Minimum peck depth

Example: G83 Z-40 I12 J3 K4 R2 F120 — first peck 12 mm, then 9, 6, 6, minimum 4 mm.

The I-J-K option reduces peck depth as the hole deepens, where chip evacuation becomes more difficult.

Fanuc Variable Peck (Type II)

Fanuc controls (16i/18i/21i and newer) offer a variable peck option with the D code:

G83 X_ Y_ Z_ R_ Q_ F_ D_ ;

Where D specifies the reduction amount per peck. The first peck depth equals Q, the second equals Q-D, the third equals Q-2D, continuing until the programmed minimum peck depth parameter (No. 5114) is reached.

G73 — High-Speed Chip Breaking Cycle (Partial Retract)

G73 retracts a small amount after each peck to break chips without fully clearing the hole. The retract distance (d) is typically 0.005–0.050 inch (0.1–1.0 mm), set by machine parameter.

Format

G73 X_ Y_ Z_ R_ Q_ F_ ;
Code Meaning
Q Incremental peck depth (each advance)
d Retract distance (machine parameter, typically 0.5–1.0 mm)

When to Use G83 vs G73

Cycle Retract Behavior Chip Removal Coolant Access Use Case
G73 Small retract (d) Partial — chips broken but not fully cleared Limited to flood coolant L/D < 5, stringy materials (aluminum, low-carbon steel), short holes
G83 Full retract to R-plane Complete — all chips cleared Full coolant access at each retract L/D > 5, steel, stainless steel, Inconel, any material with poor chip evacuation

For deep hole drilling (L/D > 5), G83 is preferred to ensure complete chip clearance. G73 should only be used in deep holes when the chip formation is known to produce small, well-broken chips that do not pack in the flutes.

Warning: G73 with inadequate retract distance can cause chip packing in deep holes, leading to tool breakage. When in doubt, use G83.

G81 — Standard Drilling Cycle (No Peck)

G81 is a simple drilling cycle with no peck action. It feeds to Z depth and retracts in rapid.

G81 X_ Y_ Z_ R_ F_ ;

Use G81 only for shallow holes (L/D < 3) in free-machining materials where chip evacuation is not a concern.

G98 vs G99 Retract Mode

Code Retract Between Holes
G98 To initial Z level (clears parts, fixtures, and clamps between holes)
G99 To R-plane only (faster cycle time; use when no interference risk exists)

Full Program Example — G83 on Fanuc/Haas

O1000 (DEEP HOLE DRILLING 4-HOLE PATTERN)
N10 T01 M06 (10mm CARBIDE DRILL) ;
N20 G90 G80 G17 G54 ;
N30 G00 X0 Y0 ;
N40 G43 H01 Z50.0 ;
N50 S1500 M03 ;
N60 M08 ;
N70 G99 G83 X25 Y25 Z-60.0 R3.0 Q10.0 F150 ;
N80 X75 Y25 ;
N90 X25 Y75 ;
N100 X75 Y75 ;
N110 G80 G00 Z50.0 ;
N120 M09 ;
N130 M05 ;
N140 M30 ;

Peck Strategy Recommendations

L/D Ratio Q (Peck Depth) Cycle Notes
≤ 3 Full depth G81 or G73 No peck required; use G81
3–5 2–3× D G73 or G83 Moderate pecking; G73 acceptable with good chip control
5–10 1–2× D G83 Standard deep hole depth; full retract recommended
10–20 0.5–1× D G83 Reduce peck depth for chip clearance at depth
> 20 0.3–0.5× D G83 + pilot hole Use dedicated deep hole drilling method preferred

Coolant M-Codes for Deep Hole Drilling

For deep hole drilling on machining centers, coolant delivery must be matched to the depth:

M-Code Function Application
M07 Mist coolant Light drilling; shallow holes
M08 Flood coolant Standard; adequate for L/D < 3
M41 / M88 Through-spindle coolant (TSC) ON Required for L/D > 3; specific code varies by machine builder
M42 / M89 Through-spindle coolant (TSC) OFF Turn off TSC
M355 High-pressure coolant ON (Haas option) 300+ PSI for deep hole drilling
M50 High-pressure coolant ON (Fanuc) Varies by machine builder
M51 High-pressure coolant OFF (Fanuc)

Minimum coolant pressure by L/D ratio:

  • L/D < 3: Flood coolant (M08) is sufficient
  • L/D 3–5: 20–40 bar (300–600 PSI) recommended
  • L/D 5–10: 40–70 bar (600–1,000 PSI) required
  • L/D > 10: 70+ bar (1,000+ PSI) with through-tool coolant

Custom Macro for Variable Peck Strategy — BTA Deep Hole Drilling

When the standard G83 progressive peck is not available (older Fanuc controls), a custom macro can implement the same logic:

(INSERT DRILL VARIABLE PECK MACRO)
(REQUIRES MACRO VARIABLES TO BE SET BEFORE CALL)
#1 = -60.0  (Z final depth)
#2 = 2.0    (R-plane height)
#3 = 10.0   (Q initial peck depth)
#4 = 1.5    (D peck reduction per cycle)
#5 = 4.0    (K minimum peck depth)
#6 = 150.0  (F feed rate)
#7 = #2     (current Z position - start)
#8 = #3     (current peck depth)

WHILE [#7 GT #1] DO1
  #7 = #7 - #8
  IF [#7 LT #1] THEN #7 = #1
  G01 Z#7 F#6
  G00 Z#2
  (RETURN TO LAST PECK MINUS SAFETY CLEARANCE)
  #7 = #7 + 0.5
  G00 Z#7
  #8 = #8 - #4
  IF [#8 LT #5] THEN #8 = #5
END1
G00 Z#2
M99

This macro reduces the peck depth by D (1.5 mm) each cycle until the minimum peck K (4 mm) is reached, then continues at the minimum peck depth to full Z depth.

Custom Macro for BTA/Boring Bar Feed (Continuous Feed)

For BTA drilling on a machining center with through-spindle coolant (not peck drilling):

(BTA DEEP HOLE - CONTINUOUS FEED)
(PRE-DRILL PILOT HOLE FIRST)
#1 = -200.0  (Z FINAL DEPTH)
#2 = 2.0     (R PLANE)
#3 = 50.0    (SAFE START Z)
#4 = 60.0    (FEED RATE mm/min)
#5 = 5.0     (DWELL AT BOTTOM seconds)

G00 Z#3
M88 (TSC ON)
G01 Z#2 F500
G01 Z#1 F#4
G04 P#5000 (DWELL)
G00 Z#3
M89 (TSC OFF)
M99

This approach maintains continuous feed without pecking, which is preferred for carbide deep hole drilling tools.

For dedicated deep hole drilling methods (gun drilling, BTA) with proper machine setup and high-pressure coolant, refer to the Peck Drilling Strategies Guide and the Deep Hole Drilling Troubleshooting Guide.

Deep Hole Drilling Editorial Team

We provide independent, practical content for deep hole drilling and precision manufacturing professionals. Our articles are researched and reviewed to ensure technical accuracy and relevance.

Have feedback? Contact us

Stay informed

Get the latest deep hole drilling insights delivered to your inbox.