Quick Guide to the G81 CNC Code [Tips & Tricks]

a graphic of a cnc machine with text that says learn g code today G81 standard drilling cycle

G81 calls a standard drilling cycle. It is a modal function that allows the machine (lathe or mill) to perform a one-pass drilling operation and retraction.

The machine will drill the hole in one straight shot and then retract out of the hole. There is no dwell or movement of the cutter away from the surface of the hole.

Just like other modal functions, you will need to deactivate it by calling another G code of the same type (canned cycle) or by using the G80 canned cycle cancel command to stop drilling.

Want to learn more about CNC G Code?

When to use a G81 code?

The G81 command is useful when you want to drill holes that are not too deep and can be drilled in just one step. G81 is the most common drilling canned cycle used.

G81 can be used for spot drilling, counterboring, reaming, boring, center drilling and other drilling operations. It is a very simple drilling cycle.

The G81 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.

G81 code format

The format for using a G81 command is shown below:

G98 (or G99) G81 X2.0 Y3.0 R1.0 Z-5.0 F25.0

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 G81 command.

In most programs you will see the G81 code in this format:

X2.0 Y3.0

G98 G81 R1.0 Z-5.0 F25.0

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

G81 code parameters

  • X – Hole location in X-Axis
  • Y – Hole location in Y-Axis
  • Z – Z axis location of the bottom of drilling motion
  • R – Position of the retract plane (for movement clearance)
  • F – Feed rate for drilling

What to think about when using a G81 code?

Positioning mode

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

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

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

If G91 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.

Retract planes

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

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

There are two codes that affect retract planes. G98 will cause the machine to return to the Z location at the start of the canned cycle. G99 will

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. 

How to cancel a G81 code?

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

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

G81 vs similar canned cycles

The G81 command is the simplest drilling canned cycle.

Besides G81 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.

Code

Name

Function

Standard drilling

Drill simple, shallow holes and center drilling

Spot drilling

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

Peck drilling - full retract

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

Peck drilling - stepped drilling

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