G81, G82, G83 and G73: Drilling Canned Cycles
Canned cycles drill a hole in one line. G81 drills, G82 adds a dwell, and G83 and G73 peck to clear or break chips. G80 cancels the cycle.
A canned cycle packs the moves for drilling a hole into one line. Instead of writing a rapid to the hole, a rapid down, a feed to depth and a retract, you give the cycle a position, a depth and a feed rate, and the control does the rest.
The common drilling cycles all use the same words:
| Word | Meaning |
|---|---|
X, Y |
Position of the hole |
Z |
Depth of the hole bottom |
R |
The R plane: the height the tool rapids down to before it starts feeding, a little above the part |
F |
Feed rate for the drilling move |
P |
Dwell at the bottom of the hole (G82, G89 and some others) |
Q |
Peck depth (G83 and G73) |
K or L |
Number of repeats: K on Fanuc, L on Haas and LinuxCNC |
After each hole, the tool returns either to the R plane or to its starting height. That is set by G98 and G99.
The cycles
- G81: drilling. Feed to Z, rapid out. Use it for spot drilling and shallow holes.
- G82: drilling with a dwell. Like G81, but the tool pauses at the bottom for the
Ptime. The dwell cleans up the bottom of spot-drilled, countersunk or counterbored holes. - G83: peck drilling. Feeds down by
Q, rapids back out to the R plane to clear the chips, then rapids back down to just above the last depth and feeds the next peck. Use it for deep holes. - G73: high-speed peck drilling. Pecks by
Qlike G83, but backs off only a short distance to break the chip instead of leaving the hole. Faster than G83, but chips stay in the hole. - G85: boring. Feeds in and feeds back out, for reamed or bored holes where a rapid retract could mark the wall.
- G80: cancel. Ends the cycle.
Other cycles cover tapping (G84) and other boring operations (G86, G88, G89).
Canned cycles are modal
Once a cycle starts, every following line with an X or Y position drills another hole using the same Z, R, F and Q, until G80 or another motion code such as G00 or G01 cancels it. That's why drilling a row of holes only needs the new position on each line:
G81 X10 Y10 Z-5 R2 F150
X30
X50
G80
Example: drilling, dwelling and peck drilling
This program drills two plain holes with G81, a third with a dwell using G82, and a 20 mm deep hole with G83. G99 keeps the tool at R2 between the first three holes, and G98 sends it back to Z25 after the deep hole.
(Drilling cycles example: G81, G82 and G83 in one program)
G21 G17 G90 G54
T1 M6 (6 mm drill)
S1800 M3
G0 X10 Y10 Z25
(G81: plain drilling, 5 mm deep, return to R2 between holes)
G99 G81 X10 Y10 Z-5 R2 F150
X30
(G82: the same hole with a 0.5 second dwell at the bottom)
G82 X50 Y10 Z-5 R2 P500 F150
(G83: peck drilling 20 mm deep, 4 mm per peck, then back to Z25)
G98 G83 X30 Y35 Z-20 R2 Q4 F120
G80
G0 Z25
M5
M30
Open it in CutViewer and step through the lines to see each hole drawn.
G99 G81 X10 Y10 Z-5 R2 F150rapids to X10 Y10, rapids down to R2, feeds to Z-5 at 150 mm/min and rapids back to R2.X30drills the second hole with the same cycle.G82 ... P500changes to G82 and dwells for 500 ms at the bottom. On Fanuc and Haas, P without a decimal point is in milliseconds; on LinuxCNC it would be seconds.G98 G83 ... Z-20 R2 Q4peck drills 20 mm deep in 4 mm pecks, and returns to Z25 afterwards.G80cancels the cycle before the finalG0 Z25.
Machine differences
- GRBL doesn't support canned cycles, so CAM software writes the hole moves out in full.
- Mach3, LinuxCNC, Fanuc and Haas support G73 and G81–G89.
- The small retract in G73 is set by a machine parameter on Fanuc-style controls, not by the program.
How CutViewer shows drilling cycles
CutViewer draws each hole in a G73, G74 or G81–G89 cycle as a rapid to the hole position, a rapid down to the R plane, a feed to the hole depth and a retract, using G98 or G99 for the retract height. G85 and G89 (and the tapping cycles G74 and G84) feed back out; the others rapid out. Pecks (Q) and dwells (P) are not drawn separately, so a G83 hole looks like one feed to full depth. Repeat counts (K or L) drill the hole that many times, and in incremental mode (G91) each repeat steps by the X and Y on the line, with R measured from the initial Z and Z from the R plane. L0 or K0 stores the cycle without drilling. G80 or any motion code ends the cycle.
Frequently Asked Questions
What is the difference between G81 and G83?
G81 feeds straight to the full depth and rapids out. G83 is a peck drilling cycle: it feeds down by the Q amount, rapids back out of the hole to clear the chips, then goes back down and repeats until it reaches full depth. Use G83 for holes deeper than about three times the drill diameter.
What is the difference between G83 and G73?
Both peck. G83 retracts all the way to the R plane after each peck so chips fall out of the hole. G73, the high-speed peck cycle, only backs off a small distance to break the chip, so it is faster but doesn't clear chips from deep holes.
What does G80 do?
G80 cancels the active canned cycle. Until it is cancelled, every line with an X or Y position drills another hole, so a missing G80 can drill a hole where you meant to make a rapid move.
Is the P dwell in seconds or milliseconds?
It depends on the control. On Fanuc and Haas, P without a decimal point is in milliseconds, so P500 is half a second. On LinuxCNC, P is in seconds. Check your control's manual before you copy a program between machines.
Does GRBL support G81 and G83?
Standard GRBL does not support canned cycles. CAM post processors for GRBL machines write each hole out as separate G0 and G1 moves instead. Mach3, LinuxCNC, Fanuc and Haas controls all support them.
More G-Code Guides
Rapid positioning and straight cutting moves.
Clockwise and counter-clockwise arcs with I/J/K or R.
Pause for a set time, in seconds or milliseconds.
Choose the XY, XZ or YZ plane for arcs.
Inch or millimetre units for the program.
Return to home or a second reference position.
Cutter radius compensation, left, right and off.
Tool length offset on and off.
Work coordinate systems and machine coordinates.
Tapping cycle, and how to work out the feed rate.
Absolute positions or incremental distances.
Set the current position by shifting coordinates.
Feed per minute, per revolution, or inverse time.
Constant surface speed or a fixed spindle RPM.
Where a drilling cycle retracts between holes.
Spindle, coolant, tool change, stop and subprogram codes.
Check your own program before you cut: open it in CutViewer to see the toolpath in 3D, the run time and any problems.
Open CutViewer