A Beginner’s Guide to Canned Cycles for Milling (Fanuc)


When you’re starting in CNC, the amount of codes and cycles you need to learn can seem a little overwhelming at first. Some say that since most people use CAM software, there is no longer any need to learn manual programming.

I disagree. While some shops do run exclusively with CAM software, it’s a huge asset to understand the codes used to program machines. Even if you’re not coding by hand every day, this will allow you to read the program to know what’s going to happen before the line is executed (handy for proveouts), and it’ll equip you with what you need to debug issues as they come up.

The intent of this article is to be an introduction to canned cycles in CNC 3-axis mill programming, based on the Fanuc controller. It’s not exhaustive, covering every little thing that can be done with each code, but it’ll cover the basics of what they do and how to pull them off successfully.

Keep in mind that every machine controller will have its own quirks and custom codes, so it’s always a good idea to check the manual. That said, canned cycles are generally pretty consistent among any Fanuc-based machines.

What is a Canned Cycle?

Put simply, a canned cycle is a command that gives the machine instructions for a pattern of movements. It’s meant to automate and simplify repetitive and common tasks, such as drilling holes.

So instead of programming every movement and function individually, a canned cycle controls a set of motions.

Since you might already know all this and simply want a quick reference list, I’ll get right into it. Later we’ll go over each of these in further detail, explaining how to use them properly and for what applications.

List of Canned Cycles for Fanuc Mills

G73High Speed Peck Drilling / Breakchip Pecking Cycle
G74Left-Hand Tapping Cycle
G76Precision Boring Cycle
G80Canned Cycle Cancel
G81Standard Drilling Cycle
G82Counter Bore Cycle (dwell at bottom)
G83Deep Hole Drilling Cycle (full retract)
G84Right-Hand Tapping Cycle
G85Reaming/Boring Cycle
G86Boring Cycle
G87Back-Boring Cycle
G88Boring Cycle
G89Boring Cycle

So as you can see there, a lot of these cycles seem pretty similar at first glance. There are a lot of boring cycles, and some of the others might not be too clear.

The next section is a breakdown of each of these canned cycles individually. What exactly do they do, and how to properly code them.

The table of contents above might be useful if you’re looking for anything in particular.

G73 – High Speed Peck Drilling

The exact words used to describe G73 may vary, but the actual movements are always pretty near identical.

I like one of the other common terms used to describe this cycle – “breakchip drilling”. This just makes it dead clear what the reason is for using this cycle.

It’s literally a drilling cycle that’s used to break up long, stringy chips. If you were to simply straight drill down into a piece of metal with a jobber drill, you would probably end up with massively long, stringy chips. These are bad for a few reasons:

  • They can wrap up around your tool and damage the workpiece, or at least scuff up the part surface
  • They can jam up your toolchanger
  • They’re a safety hazard
  • They can jam up your chip auger
  • Etc. You get it. Bad things happen.

Ok, so this is what a G73 does:

At a specified interval, the tool will make a fast retract about .005″ to .020″ or so (depending on the settings in the controller) while it’s drilling. This breaks the chips. Works like a charm.

Here are the values you need to know to use G73:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G73 is activated)
  • Q: The depth between pecks. If you punch in “Q0.100″ the tool will break the chip at every 0.100” of feed.
  • F: Feedrate. If nothing is input, then the last used feedrate will be used.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Now let’s look at an example:

G73 X1.0 Y0.0 Z-1.0 Q.15 R0.1 F10.0; (begin breakchip cycle, drill first hole at X1.0, Y0.0 to a depth of Z-1.0, pecking every 0.15″, final retract is to Z0.1, cutting is at a feedrate at 10.0 inches per minute)

X2.0; (drill another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G73. Any XY positions programmed from this point further will not automatically start a drilling operation)

G73 works well when the holes are 1xD to 4xD, aside from extenuating circumstances. For example, particularly gummy material or unusual challenges with larger chips.

A reasonable peck depth is usually 1xD max, but do whatever makes you the most comfortable. To make it easier on my chip auger, I’ve gone as little as 0.1xD when necessary. Generally larger jobber drills warrant comparatively smaller Q values.

Since the pecks happen so rapidly, it’s usually not a big deal to have a smaller Q value. Lots of guys just default to a Q of 0.1 unless they’re working with really small tools.

G74 – Left-Hand Tapping Cycle

Don’t mix up G74 and G84, or else really bad things will happen.

One thing to make sure of on your particular machine is whether it’s set to rigid tapping or not. This will make a big difference in terms of toolholder choices. Rigid tapping is definitely best.

I’ll be honest with you, there really isn’t a lot of need to use G74. You can just as easily program left-hand tapping with G84 and use a M04 instead of a M03 (CCW spindle rotation instead of CW). It’s six or half a dozen.

Here are the values to know for G74:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G74 is activated)
  • F: Feedrate. This is critical and must be properly calculated for tapping.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.
  • M29: For many controllers, this turns on rigid tapping (more accurate interpolation between the spindle speed and the feed rate). Some might use G74.4 instead. Some have it as a parameter setting in the controller. Double check in your machine programming manual.

Example:

S400 M29; (400 RPM, enable rigid tapping)

G74 X1.0 Y0.0 Z-1.0 R0.1 F10.0; (begin LH tapping cycle, tap first hole at X1.0, Y0.0 to a depth of Z-1.0, final retract is to Z0.1, cutting happens at a feedrate at 10.0 inches per minute, which is based on thread pitch and RPM)

X2.0; (tap another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G74. Any XY positions programmed from this point further will not automatically start a tapping operation)

For information on how to properly calculate the feed rate for tapping, look under the G84 tapping cycle (since that’s the one that you’ll most commonly be using)

Pro Tip: Make sure that you drill deeper than you tap so nothing crashes. Your drill will probably have a 118 or 135 degree tip, which needs to be accounted for with your tap depth.

G76 – Precision Boring Cycle

As the name implies, this is for precision boring. Here’s what this cycle does:

  • Moves to XY position over the hole
  • Feeds to the Z depth programmed
  • At the bottom of the hole, the spindle dwells, stops and orients
  • A slight movement in the X or Y axis pulls the tool away from the machined surface
  • The machine rapids up to the initial Z position or R plane

This is really useful for one purpose: the boring tool doesn’t retract while in contact with the part, scraping a line on the bore. The holes come out unmarred. With a straight retract, the deflection that’s happening while the tool is under load and cutting is applied to the bore surface while the tool is stationary, and it scrapes the part as the tool slides up and back into position.

There are a few really important notes to keep in mind as you’re planning to use a G76:

  • This cycle only works with single-fluted boring bars
  • The tool needs to be loaded in the right orientation. If you mess this up and load the tool 180-degrees from where it should be, you’ll end up driving the stationary tool into the part instead of away from it. You’ll probably end up with a chipped or broken cutter and a scrapped part

Here are the values to know:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G73 is activated)
  • Q: Shift amount at the bottom of the hole
  • P: Dwell time at the bottom of the hole
  • F: Feedrate. If nothing is input, then the last used feedrate will be used.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Sample code:

G76 X1.0 Y0.0 Z-1.0 R0.1 Q0.010 P500 F10.0; (begin precision boring cycle, bore first hole at X1.0, Y0.0 to a depth of Z-1.0, dwell for 0.5 of a second, back off 0.010″ away from the bore surface, retract is to Z0.1, cutting is at a feedrate at 10.0 inches per minute)

X2.0; (bore another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G76. Any XY positions programmed from this point further will not automatically start a boring operation)

G80 – Canned Cycle Cancel

Since canned cycles are modal commands, they’ll stay active until you turn them off. G80 is the canned cycle cancel command.

Without it, the canned cycle will repeat at every XY coordinate. When you’re done your operation, turn it off with G80.

G81 – Standard Drilling Cycle

This is the most basic holemaking canned cycle.

The tool positions itself at the top of the hole. The tool feeds to the specified Z position at the programmed feed rate. The tool retracts in rapid mode to either the previous Z position or the R plane.

Here are the values to know:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G73 is activated)
  • F: Feedrate. If nothing is input, then the last used feedrate will be used.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Sample code:

G81 X1.0 Y0.0 Z-1.0 R0.1 F10.0; (begin simple drilling cycle, drill first hole at X1.0, Y0.0 to a depth of Z-1.0, final retract is to Z0.1, at a feedrate at 10.0 inches per minute)

X2.0; (drill another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G81. Any XY positions programmed from this point further will not automatically start a boring operation)

G82 – Counter Bore Cycle

This is a basic drilling cycle with one addition: a dwell at the bottom of the hole.

This is typically used for counter boring, but it’s also good practice for spot drilling. What this allows for is the tool to complete a rotation at the bottom of the hole, rather than a fast and immediate retract which will leave marks where the tool stopped cutting suddenly.

At high RPM, you probably won’t notice much of a difference on the finished part between a G81 and a G82. If you’re using larger, slower-tooling cutters, though, it’ll be visible.

Here are the values to know:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G73 is activated)
  • P: Dwell time at the bottom of the hole
  • F: Feedrate. If nothing is input, then the last used feedrate will be used.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Sample code:

G82 X1.0 Y0.0 Z-1.0 R0.1 P100 F10.0; (begin counterboring/spotdrilling cycle, drill first hole at X1.0, Y0.0 to a depth of Z-1.0, pause for 0.1 of a second, final retract is to Z0.1, at a feedrate at 10.0 inches per minute)

X2.0; (drill another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G82. Any XY positions programmed from this point further will not automatically start a boring operation)

Picking an appropriate P value:

Lots of machinists use the following rule of thumb: pause for one full revolution of the tool.

To do this, use the following formula:

P = 1 / RPM x 60 x 1000

So if I’m counterboring at 200 RPM, I’d punch in P300, which will give me a 0.3 second dwell at the bottom of the hole.

G83 – Deep Hole Drilling Cycle

This is generally used for holes deeper than four times the diameter. This is a cycle that will use the tool to pull the chips up and out of the hole.

Here’s a play-by-play on what’s going on with the G83 cycle:

  • The tool gets into place above the hole position
  • The tool starts to feed down at the set rate up to the programmed Q distance
  • Then the tool lifts up to the R plane or original Z plane in rapid mode – chips are lifted up and thrown away by the rotating tool
  • The tool returns to where it left off and continues feeding down to the next Q level
  • Tool rapids up out of the hole, rapids back down, and continues drilling
  • Etc until the tool makes it down to the programmed Z depth. Then the tool retracts and repositions to the next hole location, where the cycle is repeated.

Here are the values you need to know to use G83:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G83 is activated)
  • Q: The depth between pecks. If you punch in “Q0.100″ the tool will break the chip at every 0.100” of feed.
  • F: Feedrate. If nothing is input, then the last used feedrate will be used.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Now let’s look at an example:

G83 X1.0 Y0.0 Z-1.0 Q.15 R0.1 F10.0; (begin deep drilling cycle, drill first hole at X1.0, Y0.0 to a depth of Z-1.0, retracting every 0.15″, final retract is to Z0.1, cutting is at a feedrate at 10.0 inches per minute)

X2.0; (drill another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G83. Any XY positions programmed from this point further will not automatically start a drilling operation.

If you’re not dead clear on the differences between G73 and G83, I’d really recommend taking a look at this article I wrote that spells out the distinctions between the two cycles:

What’s the Difference Between G73 and G83?

G84 – Right-Hand Rigid Tapping Cycle

This is a really common one that you’ll probably use all the time. It’s almost identical to G74, except that this one is the standard in the large majority of shops. You can actually program both right hand and left hand tapping with G84.

Here’s the breakdown of motions:

  • Tool positions itself over hole location
  • Spindle starts to rotate in programmed direction (default is CW)
  • Machine hesitates – the machine is reading the feedback on the encoders and is calculating what it needs to synchronize the spindle rotation with the Z feedrate
  • The tool feeds down at the programmed rate with the spindle RPM synchronized and taps the hole down to the programmed Z depth. At this point, the Feed Hold button is locked out, so the only way you can stop the cycle while the tap is in the hole is by hitting E-Stop.
  • The spindle kicks into reverse and the tool feeds upwards to the R plane or the last Z position. On some controllers, the retract feedrate and RPM is double to make for faster tapping
  • The spindle is switches direction again to get ready for tapping the next hole.

Here are the values to know for G84:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G84 is activated)
  • F: Feedrate. This is critical and must be properly calculated for tapping.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.
  • M29: For many controllers, this turns on rigid tapping (more accurate interpolation between the spindle speed and the feed rate). Some might use G84.4 instead. Some have it as a parameter setting in the controller. Double check in your machine programming manual.

Example:

S400 M29; (400 RPM, enable rigid tapping)

G84 X1.0 Y0.0 Z-1.0 R0.1 F10.0; (begin tapping cycle, tap first hole at X1.0, Y0.0 to a depth of Z-1.0, final retract is to Z0.1, cutting happens at a feedrate at 10.0 inches per minute, which is based on thread pitch and RPM)

X2.0; (tap another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G84. Any XY positions programmed from this point further will not automatically start a tapping operation)

Here’s how to calculate the correct feed rate:

Multiply the RPM by the thread pitch and number of starts in the thread. 

Note that thread pitch here is the linear distance between threads, not the amount of threads per inch. So if you’re trying to tap 1/4-20 threads, where there are twenty threads per inch, divide the 20 by 1 to get the actual distance between threads. 1 / 20= 0.050″

So the formula is:

Feed Rate = RPM x Pitch x Number of Starts

Now some people use a different, simplified formula for inch threads, but it doesn’t really work for metric. This formula works for both.

If you don’t want to do the calculations, just plug them into this calculator and it’ll take care of them for you.

Operator Tip: For tapping cycles, the feed hold is disabled. This is because the spindle rotation is synchronized with the feed rate, and the spindle can’t be stopped instantly like the feed can. What this means is that, if you need to stop the machine while it’s tapping, you need to hit the E-stop button, which will be almost guaranteed to snap your tap. Make sure your Z depth is correct before you start the cycle, since there’s no easy way to stop once you’re tapping. It really sucks when you notice that you programmed Z-10.0 instead of Z-1.0 as the tap starts to cut.

G85 – Reaming/Boring Cycle

This is a very simple canned cycle, and almost identical to the G81 cycle, but with one major difference: The tool uses the feed rate instead of a rapid motion on the retract.

Here’s what happens with the G85 cycle:

  • Tool is positioned over hole location
  • Tool feeds down to the Z level at the programmed feedrate
  • Tool feeds back up to either R plane or initial Z level using feedrate
  • Tool moves to next hole position in rapid mode

Here are the words that can be used:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G84 is activated)
  • F: Feedrate. This is critical and must be properly calculated for tapping.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Example:

G85 X1.0 Y0.0 Z-1.0 R0.1 F10.0; (begin cycle, cut first hole at X1.0, Y0.0 to a depth of Z-1.0, final retract is to Z0.1, cutting is at a feedrate at 10.0 inches per minute)

X2.0; (cut another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G85. Any XY positions programmed from this point further will not automatically start a drilling operation)

Here’s when you’d want to use this cycle:

Aside from not leaving spiral marks on the inside of the hole from a rapid retract, this gives the opportunity for a spring pass. This can be a two-edged sword, though; if the spring pass is too light, then the cutter will rub instead of cut. This will leave an ugly surface finish.

But if the tool is sharp and can cut well on the spring pass, then this could work really well for making beautiful, accurate holes.

G86 – Boring Cycle

Yet another one of the many boring canned cycles… Here’s what’s special about this one:

There’s an optional dwell at the bottom of the hole, the spindle stops, and then the tool retracts.

Here’s the cycle, step-by-step:

  • Tool positions over hole location
  • Tool feeds down to programmed depth
  • Tool dwells at the bottom of the hole for the programmed time (optional)
  • Spindle stops
  • Tool retracts in rapid mode
  • Spindle starts rotating again

To be honest, even though this is usually called a boring cycle, I only use it for reaming. It’s faster than the G85 cycle and it’s less likely to produce an oversized hole from that spring pass retract.

Here are the values:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The depth of the first hole (absolute)
  • R: Retract plane (optional – default is the last Z point before G84 is activated)
  • P: Optional dwell time – if nothing is input, then there will be no dwell
  • F: Feedrate. This is critical and must be properly calculated for tapping.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Here’s an example program segment:

G86 X1.0 Y0.0 Z-1.0 R0.1 P100 F10.0; (begin cycle, cut first hole at X1.0, Y0.0 to a depth of Z-1.0, final retract is to Z0.1, dwell at bottom of hole is 0.1 seconds, cutting is at a feedrate at 10.0 inches per minute)

X2.0; (cut another hole with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G86. Any XY positions programmed from this point further will not automatically start a drilling operation)

You’re going to want to be careful with the dwell at the bottom of the hole. If this number is too large, it could cause chatter and wreck the surface finish, giving you an oversized hole. Most machinists omit this entirely, although you could apply the same principle as counterboring without issue: dwell for once full rotation of the spindle to ensure smooth surfaces on the step.

G87 – Back-Boring Cycle

To be totally up front with you, this one is more complicated.

If you’re back-boring to a step, this is the cycle you use. Its setup is involved and it’s easy to screw up, so only use it if you need to.

Here’s the basic chain of events:

  • The spindle stops and orients
  • The tool is offset from the hole centerline so that it can fit in the hole
  • The tool rapids down into the hole so the cutting edge is on the other side of the workpiece
  • The tool positions itself on the centerline of the hole
  • The spindle starts to rotate
  • The tool feeds upwards, boring the underside of the hole to the programmed Z level
  • The spindle stops
  • The tool is backed away from the bore surface, to the same XY point where it entered the hole
  • The tool retracts to the R plane or last Z position

Since this one is a little more involved, here’s a video that shows the exact motions of this cycle:

Here are the codes to know. Notice that some of the values are very different from previous canned cycles:

  • X: The X location of the first hole (absolute with G90, incremental with G91)
  • Y: The Y location of the first hole (absolute with G90, incremental with G91)
  • Z: The “safe point” that the tool needs to travel down to in order to clear the underside of the hole
  • R: Retract plane (optional – default is the last Z point before G84 is activated)
  • I: The amount of offset in the X axis from the center of the hole required for the tool to safely enter the pre-existing hole
  • J: The amount of offset in the Y axis from the center of the hole required for the tool to safely enter the pre-existing hole
  • K: The incremental distance that the tool needs to feed from the programmed Z depth to reach the upper boring limit
  • F: Feedrate. This is critical and must be properly calculated for tapping.
  • K: Number of times to repeat. Optional and only useful if you’re using G91 incremental positioning.

Here’s some sample code:

G87 X1.0 Y0.0 Z-1.1 I0.050 J0.0 K0.60 R0.1 F10.0; (begin backboring cycle, cut first hole at X1.0, Y0.0. Offset to fit tool in hole is 0.050″ in X axis. Enter the workpiece to Z-1.1, feed up 0.6 to cut a counterbore 0.50 deep, final retract is to Z0.1, cutting is at a feedrate at 10.0 inches per minute)

X2.0; (cut another backbore with the same parameters at X2.0, Y0.0)

X3.0; (yet another identical hole at X3.0, Y0.0)

G80; (cancel G87. Any XY positions programmed from this point further will not automatically start a drilling operation)

The cycle also works well for back-chamfering. Since this is a complicated cycle, it’s a good idea to test it out a couple times with a common Z workpiece shift above the part so you can make sure you got all the values right.

Ultimately, though, this cycle can really be worth the effort. It can mean than you can possible finish a part in a single setup, which can make manufacturing considerably less expensive.

G88 – Boring Cycle

This one is more so practical for one-offs or really small production runs.

The reason for this is that the retract is manual. Here’s the order of events:

  • Tool positions over hole
  • Boring tool feeds down to programmed Z level
  • Tool dwells for specified time
  • Program stops
  • Operator manually retracts the tool to a safe location
  • Spindle restarts and program continues

Even though I said that this cycle is practical for one-offs, it’s really not common to see. There’s generally no reason to use this over a regular boring cycle, unless you have something genuinely wierd going on.

G89 – Boring Cycle

This is really similar to G85, except that you can program a dwell at the bottom of the hole. Use a P value for this.

Since this is so similar to G85, just look up that code for all the details.

Ok, there you have it! A basic introduction to canned cycled for milling. If you have any questions, observations or advice then use the comments below.

Jonathan Maes

I've been working in manufacturing and repair for the past 14 years. My specialty is machining. I've managed a machine shop with multiaxis CNC machines for aerospace and medical prototyping and contract manufacturing. I also have done a lot of welding/fabrication, along with special processes. Now I run a consulting company to help others solve manufacturing problems.

Recent Posts