G82 CNC Code Explained: An Easy Intro for Beginners [Drill with Dwell]

What does a G82 code do?

The G82 code is for a standard drilling cycle with a dwell at the bottom of the hole.

The machine will drill the hole in one straight shot, stop for a set amount of time at the bottom of the hole and then retract out of the hole.

G82 is a modal command and just like other modal codes you will need to deactivate it by calling another G code of the same type (canned cycle in this case) or by using the G80 canned cycle cancel command to stop drilling.

G82 Code Illustration

Learn CNC Programming – It’s Easier Than You Think!

Learning G Code doesn’t have to be difficult…

If you know what to focus on.

Join our simple, easy-to-follow course, “G Code Made Easy: CNC Programming for Beginners“. We walk you through all the important codes – with simple explanations and real-world examples.

Want to become a super-skilled CNC programmer? Join now to take the shortcut to becoming a G Code Master today!

Make Learning G Code Easy

When to use a G82 code?

The G82 command is useful when you want to drill holes that are not too deep and can be drilled in just one step.

It is used most often when the hole being drilled needs a better surface finish at the bottom of the hole.

The G82 canned cycle does not include any retract steps (pecks) when drilling.

For this reason, if you want to drill a deep hole, the best option would be to use the G83 peck drilling deep hole canned cycle. Peck drilling will help clear chips.

illustration that shows the difference between peck drilling and standard drilling in a CNC machine

Other codes used with the G82 code

G82 code format

The format for using a G82 command is shown below:

G82 X2.0 Y3.0 R1.0 Z-5.0 P500 F25.0 G98

It would be easy to assume that the Z location is the location of the start of the hole. In reality, it is the Z location for the bottom of the hole drilling movement.

Keep in mind that the X and Y coordinates of the hole are not usually in the same line as the G82 command.

In most programs you will see them in this format:

X2.0 Y3.0

G98 G82 R1.0 Z-5.0 P 500 F25.0

The program first identifies the coordinates of the hole and then starts the drilling process.

What to think about when using a G82 code?

Retract planes

The retract plane is the location that the machine will return to after each canned cycle.

There are two codes that affect retract planes.

The G98 code will cause the machine to return to the Z location at the start of the canned cycle.

The G99 code will tell it to return to the R plane.

visualization of how a cnc machine moves using g98 and g99 codes shows motion of travel for the machine

Selecting a retract plane that is above any potential obstacles in the machine such as fixtures, clamps, or the part itself will allow the machine to safely move between each hole drilling location.

If the R plane is too low it could cause damage on the workpiece and lead to disaster. However, if an R plane is too high above the workpiece’s surface, it could increase machining time, due to the extra time needed to go all the way up to the R value after each drilling. 

Positioning mode

When using the G82 canned cycle, you will need to be aware of the positioning mode that is currently active.

If the G90 code is active, the machine will read all locations as relative to a single zero location.

If the G91 code is active, the machine will read all locations as relative to its current position.

Pay careful attention to your current positioning mode because using the wrong one can easily result in a machine crash.

graph paper example of absolute positioning with multiple points as examples
graph paper example of incremental positioning with multiple points as examples

How to cancel a G82 code?

The G80 command is used to cancel a G82 code as well as all other canned cycles.

If the G82 command is not canceled, then the machine will continue to drill holes at every location given in the program.

G82 vs Similar Canned cycles

The G82 command is one of the simplest drilling canned cycles.

Besides G82 there are a few other G-codes for drilling holes with slight variations in the drilling process which make them better to use in certain circumstances.




Drill simple, shallow holes and center drilling

Standard drilling cycle with a dwell at the bottom of the hole

Drill into the part in steps (pecks) and after each peck, fully retract from the hole

Similar to G83, but instead of retracting completely out of the hole, the machine will pull back a specified amount and then resume drilling

Want to learn more about CNC G Code?

Leave a Comment