What Is a Canned Cycle in CNC? Types and G-Codes

A canned cycle is a single line of G-code that automates a repetitive machining operation on a CNC machine. Instead of writing out every individual tool movement (rapid down, feed into the material, retract, reposition, repeat), you call one command that handles the entire sequence. It’s essentially a shortcut built into the machine’s controller, and it’s one of the first things CNC programmers learn because it dramatically reduces the amount of code needed for common operations like drilling, boring, and tapping.

How a Canned Cycle Works

Think of a canned cycle as a pre-packaged set of instructions. When you program a drill to make 50 holes across a part, you don’t want to write the plunge-and-retract motion 50 times. A canned cycle lets you define the operation once (how deep, how fast, where to retract) and then simply list the hole locations. The controller fills in the rest.

Each canned cycle block contains a few key parameters that tell the machine everything it needs to know:

  • Z depth: how deep the tool should cut into the material
  • R plane: the height above the workpiece where the tool positions itself before plunging (the retraction or reference plane)
  • F feed rate: how fast the tool feeds into the material
  • Q peck depth: used in peck drilling cycles, this sets how far the tool advances before retracting to clear chips
  • P dwell time: a pause at the bottom of the cut, used in spot drilling and boring to improve surface finish

A typical canned cycle line might look like G83 X1.0 Y2.0 Z-1.5 R0.1 Q0.25 F150. That single block tells the machine to peck drill at coordinates X1.0 Y2.0, going 1.5 inches deep, starting from 0.1 inches above the surface, pecking in 0.25-inch increments, at a feed rate of 150. Without the canned cycle, this same operation would require multiple lines of code for each peck.

Common Canned Cycle Types

Most CNC mills share a standard set of canned cycles. The exact G-code numbers are consistent across Fanuc-based controllers, which includes Haas and many other brands:

  • G81 (Simple Drill): the most basic cycle. The tool feeds to the programmed depth in one pass, then retracts. Used for shallow holes where chip evacuation isn’t a concern.
  • G82 (Spot Drill with Dwell): identical to G81, but the tool pauses briefly at the bottom of the hole. That dwell cleans up the hole bottom and is useful for counterboring or spot drilling.
  • G83 (Deep Hole Peck Drill): the tool feeds down in increments (set by the Q value), fully retracting out of the hole after each peck. This clears chips from the flutes and prevents the drill from binding in deep holes.
  • G73 (High-Speed Peck Drill): similar to G83, but instead of retracting completely out of the hole, the tool only backs off a small amount after each peck. This breaks the chips without wasting time on full retracts, making it faster for materials that produce short, manageable chips.
  • G84 (Tapping): feeds the tap into the hole at a synchronized speed and then reverses the spindle to back out. The controller coordinates spindle RPM and feed rate automatically.
  • G85 (Boring): feeds in at the programmed rate, then feeds back out at the same rate rather than rapid retracting. This produces a smoother bore finish.
  • G76 (Fine Boring): the tool feeds to depth, the spindle orients to a specific position, the tool shifts slightly off the wall, and then it retracts without dragging across the finished surface.

G83 vs. G73: Full Retract vs. Chip Break

The difference between these two peck drilling cycles is worth understanding because choosing the wrong one costs time or risks a broken drill. G83 (deep hole peck) retracts the tool all the way out of the hole after each peck increment. This guarantees chip clearance and allows coolant to flood the hole, making it the safer choice for deep holes in gummy materials like aluminum or stainless steel.

G73 (chip-breaking peck) only retracts a tiny amount after each increment. The chips snap but stay in the hole. This works well for cast iron and other materials that produce small, brittle chips, and it’s significantly faster because the tool isn’t traveling in and out of the hole repeatedly. For a 2-inch deep hole with 0.25-inch pecks, G73 can save several seconds per hole, which adds up across dozens or hundreds of holes on a production part.

How Retraction Height Works

Two codes control where the tool goes after completing each hole in a canned cycle: G98 and G99. Getting these right matters when your part has clamps, fixtures, or raised features between holes.

G98 tells the tool to retract to the “initial level,” which is wherever the tool was positioned before the canned cycle started. This is the safer option when traveling between holes that have obstacles in the way, because the tool pulls up high before repositioning. G99 tells the tool to retract only to the R plane, the reference height just above the workpiece. This is faster when there’s nothing between the holes and the tool can stay close to the surface.

If you’re drilling a row of holes on a flat plate with no obstructions, G99 saves cycle time. If you’re drilling holes on either side of a clamp, G98 prevents the tool from crashing into it during the rapid move between positions.

Modal Behavior and Canceling

Canned cycles are modal, meaning they stay active until you explicitly cancel them. Once you call G83, every subsequent line that contains X and Y coordinates will trigger another peck drill operation at that location. This is what makes canned cycles so efficient for patterns of holes: you define the cycle once and then list positions.

When you’re done drilling, you cancel the cycle with G80. This is a critical step. If you forget G80 and then command a move to a new position, the machine may attempt to drill there. After calling G80, you also need to re-establish a motion mode (like G00 for rapid positioning) before commanding any axis movement. Skipping that step will trigger an error on most controllers.

A typical sequence looks like: call the canned cycle with all parameters, list hole positions across several lines, then end with G80 followed by G00 to resume normal rapid movement.

Why Programmers Rely on Them

The practical benefits go beyond just saving keystrokes. Shorter programs are easier to read and debug. When you need to change the feed rate for a set of 30 holes, you edit one line instead of hunting through 30 blocks of longhand code. The risk of typos and missed lines drops substantially when you’re writing 5 lines of code instead of 50.

Canned cycles also standardize the tool motion. Every hole gets the exact same approach, peck depth, dwell, and retract. In manual point-to-point programming, it’s easy to accidentally leave out a retract move or miscalculate a depth on one hole out of many. The canned cycle eliminates that class of error entirely.

Differences Across Controllers

The core canned cycle G-codes (G81 through G89, plus G73 and G76) are largely standardized across Fanuc-style controllers, which covers a huge share of the machines in use today, including Haas. If you learn canned cycles on a Haas mill, the same G-codes and parameters will work on a Fanuc-controlled machine with minimal changes.

Haas controllers add a layer of convenience with conversational programming templates that let operators set up canned cycles through on-screen menus rather than typing raw G-code. Okuma’s OSP control uses a different programming dialect but offers its own set of powerful canned cycles. The underlying concept is identical across all platforms: define the operation, list the positions, let the controller handle the repetitive motion.

Where you’ll find real differences is in advanced cycles. Some controllers offer built-in cycles for bolt-hole circles, grid patterns, or custom pocketing routines that go beyond the standard set. These are manufacturer-specific and require checking the programming manual for your particular machine.