G-Code Canned Cycles: Drilling, Tapping, and Boring Cycles Explained
Canned cycles are built-in G-code subroutines that execute a complete hole-making sequence from a single block. UTEC Industrial provides precision CNC machining services for large and oversized industrial components in the Pacific Northwest, with in-house heat treatment and induction hardening integrated into the machining workflow. Instead of programming approach, feed, dwell, and retract individually, the programmer specifies the cycle type, hole location, depth, and feed rate — the control handles the rest. Canned cycles reduce program length for bolt circles and hole patterns, enforce the correct sequence for each operation, and are standard for all CNC machining center hole-making. This article covers G81 (drill), G83 (peck drill), G84 (rigid tap), G76 (fine bore), and G85/G86 (boring), with parameter syntax and applications in alloy steel and large industrial components.
What is a canned cycle and how does it work in a G-code program?
A canned cycle is a G-code modal code (from Group 9 on Fanuc-compatible controls) that encodes a complete fixed sequence of machine motions for a specific hole-making operation. Once a canned cycle is called with its parameters, it executes automatically at each hole location that appears in subsequent blocks until the cycle is cancelled with G80. The standard canned cycle parameters on Fanuc-compatible controls: R — the R-plane (the Z-height above the part surface where the tool transitions from rapid to feed motion); Z — the final hole bottom depth (absolute or incremental from the R-plane, depending on G90/G91 mode); Q — the peck increment for peck drilling cycles (G83); P — dwell time at the hole bottom (in milliseconds); F — feed rate (ipm for milling, ipr for some tapping cycles). The cycle execution sequence for G81 (basic drill): the tool rapids to the XY hole location; rapids in Z to the R-plane; feeds at the programmed F rate from R-plane to Z-depth; retracts to R-plane (or to initial Z-level if G98 is active) at rapid. All of this from a single block. For a bolt circle of 8 holes in 4140: call G81 once with the depth and feed parameters, then list the 8 XY coordinates — 9 blocks total instead of 40+ blocks for the same sequence programmed as individual moves. The cycle remains active (modal) until G80 cancels it — any block with an XY move while a canned cycle is active will execute the cycle at that XY position (Smid, CNC Programming Handbook, 3rd ed., Industrial Press, 2008; Machinery's Handbook, 31st ed., Industrial Press, 2020).
When is G83 peck drilling required and what peck increment is appropriate?
G83 is the peck drilling canned cycle — it advances the drill in incremental steps (the Q parameter) to the Z-depth, retracting fully to the R-plane between each peck to clear chips before re-entering. G83 is required whenever the hole depth exceeds approximately 3 times the drill diameter — the threshold above which chips pack in the flutes and cannot be cleared by the coolant flow alone, causing drill breakage. In alloy steel (4140 at 250–302 HB): peck drilling is required for all holes deeper than 3D. For a 1/2-inch drill: G83 required at depths over 1.5 inches. Appropriate Q (peck increment): 0.5–1.0× the drill diameter per peck. For a 1/2-inch drill in 4140: Q0.375–Q0.500 (0.375–0.500 inch per peck). Deeper pecks remove more material per cycle and reduce cycle time but increase the risk of chip packing before the retract clears the flutes. Shallower pecks (Q0.125–Q0.200) are used for hard alloys, deep holes (over 10D), or when the drill is showing signs of chip packing (squealing, burning smell). With through-spindle coolant at high pressure (300+ psi directed through the drill body): chip evacuation is significantly more effective, and peck increment can be increased to 1.5–2.0× diameter. High-pressure through-spindle coolant directed at the drill point breaks up the chip formation and flushes chips to the surface, often eliminating the need for G83 peck drilling in favor of G81 continuous feed with through-spindle coolant — acceptable for holes to 6–8D in 4140 with 300+ psi coolant. For blind holes in stainless steel or high-alloy material: use G83 with conservative pecks (Q = 0.3–0.5× D) regardless of depth, because stainless work-hardens rapidly in the hole bottom zone, increasing the force on each peck re-entry (Smid, CNC Programming Handbook, 3rd ed., Industrial Press, 2008; Machinery's Handbook, 31st ed., Industrial Press, 2020).
How is G84 rigid tapping programmed and what makes it different from G74 floating tap cycles?
G84 is the rigid tapping cycle — the standard tapping method on modern CNC machining centers. In rigid tapping, the spindle rotation and the Z-axis feed are electronically synchronized: the control drives the Z-axis at exactly F = spindle RPM × thread pitch, so the tap advances at exactly one pitch per revolution. When the tap reaches the programmed Z-depth, the spindle reverses and the Z-axis retracts at the same synchronized rate, backing the tap out of the hole at the same pitch. No tapping attachment or floating holder is needed — the rigid spindle drive directly controls the tapping operation. G84 syntax on Fanuc: G84 Z[depth] R[r-plane] F[pitch in inches/revolution]. For a 1/2-13 UNC thread: pitch = 1/13 = 0.0769 inch/revolution, so F0.0769. The spindle speed is set with S before calling G84 — for 1/2-13 in 4140 at 15 SFM: RPM = (15 × 12) / (π × 0.500) = 115 RPM, set S115 before G84. The control synchronizes the Z feed automatically from the S and F values. G74 (counterclockwise tapping, for left-hand threads) uses the same parameter structure but with M04 (CCW spindle) active. The older floating tap cycle (sometimes called G84 on older Fanuc 6M controls but implemented without spindle-Z synchronization): requires a tension-compression tapping attachment that floats the tap axially to accommodate small timing mismatches between spindle speed and Z-axis feed. Modern machining centers (Fanuc 16 and later, Siemens 840D, Mazatrol M-Plus) implement true rigid tapping with spindle encoder feedback — floating holders are not required and not recommended, as the float introduces axial position uncertainty that can cause overshooting a blind-hole bottom. For tapping holes in the ends of large shaft sections at UTEC — axle-end tapped holes for retention hardware — the Mori Seiki machining center's rigid G84 cycle produces clean, accurate threads without the tap breakage risk of manual tapping operations on the drill press (Smid, CNC Programming Handbook, 3rd ed., Industrial Press, 2008).
What is the G76 fine boring cycle and when is it used instead of G85 or G86?
G76 is the fine boring canned cycle designed for precision bore work to tight diameter tolerance (IT6–IT7). The key feature that distinguishes G76 from simple boring cycles (G85, G86) is the oriented spindle stop at the hole bottom: when the boring bar reaches the Z-depth, the control stops the spindle at a programmed angular orientation and shifts the tool a small amount radially away from the bore wall before retracting. This radial shift — programmed with the Q parameter — lifts the boring bar tip away from the bore wall during retraction, preventing the tool from marking the finished bore surface as it backs out. Without this shift, a standard boring bar retracts through the same arc it cut, and the tool tip drags across the finished bore surface, leaving a retraction scratch that degrades the bore finish and may produce an out-of-round mark detectable during bore gauging. G76 syntax: G76 Z[depth] R[r-plane] Q[shift amount] P[dwell at bottom] F[feed]. Q is specified in the control's increment units (0.001 inch or 0.001 mm typically) and represents the radial shift distance. For a precision bore where the retraction mark must be avoided: Q50 shifts the tool 0.050 mm (0.002 inch) radially before retract — enough to clear the bore wall without leaving a mark. The dwell P at the bottom (P200 = 200 milliseconds) allows the spindle to fully stop at orientation before the shift and retract sequence begins. G76 is the correct cycle for any bore tolerance tighter than IT8 (approximately ±0.001 inch for mid-range diameters) and for any bore that will be measured for surface finish — Ra 32 µin finishes are achievable with G76; dragging the bar back without the shift typically degrades the finish to Ra 63–125 µin at the retraction mark. G85 (bore in, rapid retract) and G86 (bore in, spindle-stop retract, rapid) are used for roughing bores and clearance holes where retraction marks are acceptable (Smid, CNC Programming Handbook, 3rd ed., Industrial Press, 2008; Machinery's Handbook, 31st ed., Industrial Press, 2020).
How are canned cycles used for bolt circles and hole patterns on large flanged components?
The most common production application of canned cycles in heavy industrial machining is bolt circles and hole patterns on flanges, covers, and end plates — the secondary drilling and tapping operations that follow primary turning or milling. The G-code approach for a bolt circle is concise and reliable: define the cycle once, then list the hole positions. For an 8-hole bolt circle of 1/2-inch diameter through holes in 4140, on a 6-inch bolt circle diameter: G98 G83 Z-1.500 R0.100 Q0.375 F5.5 (peck drill cycle, full retract to initial Z between holes, 0.375-inch pecks, 5.5 ipm feed); X3.000 Y0.000 (hole 1 at 0°); X2.121 Y2.121 (hole 2 at 45°); X0.000 Y3.000 (hole 3 at 90°) — and so on for all 8 positions. Eight holes defined in 9 blocks. G80 (cancel the cycle) follows the last hole. For the equivalent tapping of those 8 holes (after drilling and chamfering): G98 G84 Z-1.200 R0.100 F0.0769 with S115 set before the cycle, then the same 8 XY positions. Total program blocks for drill + tap of 8 holes: approximately 25 blocks, versus 80–100 blocks for the equivalent explicitly-programmed moves. For large crane wheel flanges with 12 or more bolt holes on multiple bolt circles: the program block reduction from canned cycles is proportionally greater. UTEC's bolt circle drilling programs for custom flanged components use G83 or G84 cycles with the hole positions generated from a simple coordinate calculation (bolt circle diameter divided by number of holes, converted to XY positions) — the machinist verifies the first hole position by dry-running to the R-plane and measuring before running the full pattern (Smid, CNC Programming Handbook, 3rd ed., Industrial Press, 2008).
What are the G-code turning canned cycles (G71, G72, G76) and how are they used?
On CNC turning centers with Fanuc-compatible controls, the turning canned cycles are the equivalent of the machining center hole cycles — they compress multi-pass roughing, facing, and threading sequences into compact program structures. G71 (stock removal in turning): the most important turning canned cycle. The programmer defines the final part profile (as a sub-program or a sequence of profile blocks between labeled lines) and the roughing parameters — depth of cut per pass, finishing stock allowance, feed rate. The control automatically calculates and executes all roughing passes parallel to the final profile, stepping in by the programmed depth until only the finishing stock remains. Then G70 (finishing cycle) executes a single pass at finish parameters along the defined final profile. The combination of G71 rough + G70 finish is the standard programming structure for most CNC turning operations from bar or billets. G72 (facing stock removal): the same concept as G71 but for facing — removes stock in the Z direction rather than the X direction. Used for facing large flanges and facing workpieces to length from over-length billets. G76 (threading cycle on lathes): the turning thread canned cycle that calculates the number of passes, infeed angle, and finishing pass for a specified thread form. Parameters: thread pitch (k), thread height (D), first infeed amount (i), minimum chip depth (Δd_min), finishing allowance (a), thread form angle. G76 on a Fanuc lathe is more complex to set up than the equivalent G84 tapping cycle on a machining center, but it handles all external and internal thread forms with a single cycle call. For crane wheel axle threads (1-1/2-8 UNC, 2-inch diameter, 4-inch long): G76 programs the 15–20 threading passes required to reach full thread depth from the rough-turned minor diameter, including the spring pass at full depth that seats the thread form (Smid, CNC Programming Handbook, 3rd ed., Industrial Press, 2008; Machinery's Handbook, 31st ed., Industrial Press, 2020).
What common canned cycle errors cause dimensional problems and how are they avoided?
Several canned cycle programming errors consistently cause dimensional problems in production machining. R-plane set too close to the part surface: the R-plane must provide sufficient clearance for the tool to reach full rapid speed before entering the cut. A G83 peck cycle with the R-plane set at Z+0.010 above the part does not allow the tool to accelerate before entering the material — the first peck hits the part surface at reduced speed, producing an inconsistent entry that can deflect the drill off the intended axis. Set R-plane at Z+0.100 minimum for all cycles in steel. Z-depth sign error: all depth values in canned cycles are typically negative in absolute G90 mode (below the Z0 datum). A Z+1.500 in a G83 cycle tells the control to drill above the workpiece surface — a rapid crash into the air and a missed hole. Always verify the sign of the Z-depth value before running the first hole. Q value specified in wrong units: on Fanuc controls, Q in G83 is specified in units of 0.001 mm or 0.001 inch depending on the active unit mode (G20/G21). A programmer who writes Q0.375 intending 0.375 inch pecks while the control is in millimeter mode will produce 0.000375 mm pecks — effectively no peck, continuous feed. Always confirm G20/G21 mode is set correctly at the program header before running canned cycles. G80 missing at the end of the cycle: if the canned cycle is not cancelled with G80 after the last hole, any subsequent XY positioning move in the program will execute the cycle again at the new position. The tool will drill, tap, or bore at an unintended location. G80 must immediately follow the last hole position in every canned cycle sequence (Smid, CNC Programming Handbook, 3rd ed., Industrial Press, 2008).
- G-Code Fundamentals: Program Structure, Coordinates, and Modal Commands — the G-code foundation that canned cycles build on
- Work Offsets and Tool Compensation in CNC Programming — the offset system that positions canned cycles correctly on the part
- Drill Press Operations: Drilling, Tapping, Reaming, and Countersinking — manual hole-making operations that canned cycles replace on the CNC
- CAD/CAM Workflow for CNC Machining: From Model to Finished Part — how CAM systems generate canned cycle calls automatically
References
- Smid, P. (2008). CNC Programming Handbook, 3rd ed. Industrial Press.
- Machinery's Handbook, 31st ed. Industrial Press, 2020.
- Kief, H.B., Roschiwal, H.A., and Schwarz, K. (2020). The CNC Handbook. Industrial Press.
- Madison, J. (1996). CNC Machining Handbook. Industrial Press.
Need Precision CNC Machining?
UTEC Industrial provides large-scale CNC machining services from our 25,000 sq ft facility in Spokane Valley, WA — equipped with Mazak, Monarch, and Mori Seiki machining centers, plus a gantry bandsaw cutting sections up to 50" × 84".