G99 tells your CNC machine to return the cutting tool to the R plane after each canned cycle operation. The R plane is the clearance height you define with the R word in your code — it sits just above the part surface.
This is the faster of the two retract options. The alternative is G98, which lifts the tool all the way back to where it started before the canned cycle. G99 skips that extra travel and keeps the tool closer to the work.
Key Takeaways
- G99 returns the tool to the R plane after each canned cycle hole — not the initial point
- It’s faster than G98 because the tool doesn’t travel as far between holes
- Use it when there are no clamps, fixtures, or obstacles between holes
- G98 is the safer default — switch to G99 only when you’ve confirmed the path is clear
- G99 is modal: it stays active until you switch to G98 or cancel with G80
- On lathes, G99 means something different — it sets feedrate to feed per revolution
| G99 – At A Glance | |
|---|---|
| Function | Return to R plane after canned cycle |
| Type | Modal (Group 10) |
| Cancelled by | G98, G80 |
| Default on most controls | No (G98 is default) |
| Used with | G73, G74, G76, G80–G89 |
| Machine type | Machining center (mill) |
G99 vs G98
Both G99 and G98 control where the tool goes after finishing each hole in a canned cycle. The difference is how high the tool travels.

G99 retracts to the R plane — the clearance height set by the R word in your code. The R plane is close to the part surface. That short move is what makes G99 faster than G98.
G98 lifts the tool all the way back to the initial point — wherever Z was before the canned cycle started. If you started your cycle at Z5.0, that’s where G98 returns after every hole.
G99 is great for reducing cycle time. G98 is safer when clamps, fixtures, or other obstacles are nearby. Use G99 only when you’ve confirmed the path between holes is clear.
COMMON MISTAKE – R plane set too low with G99
If the R plane is set too close to the part (like R0.05), the tool barely clears the surface between holes. That’s fine when moving between holes in flat, open stock — but it’s a crash waiting to happen if there’s a clamp or workstop in the way.
Always set your R value to clear everything on the fixture, not just the part. And if you’re unsure, use G98 instead.
Parameters Used with G99
G99 is paired with a canned cycle code and a set of words that define the hole operation. Here’s what each one does:
- Initial plane — The Z height before the canned cycle starts. G99 does NOT return here — but you should still set it above all obstacles before starting the cycle.
- R — The R plane (retract plane). This is where G99 returns after each hole. Set it just above the part surface, clearing all clamps and fixtures.
- Z — The bottom of the hole. How deep you’re drilling, boring, or tapping.
- X / Y — The position of each hole on the part.
- F — Feedrate. How fast the tool moves into the material. Depends on tool diameter and material.
The R value is critical with G99. Because the tool stays at R between holes, anything taller than R will cause a collision. A common starting point is R0.1 (about 2.5mm above the surface) — but verify this against your fixture height.
G99 Code Format
The basic format for a drilling canned cycle with G99 looks like this:
G81 G99 X0 Y0 R0.1 Z-1.0 F5.0
- G81 — The canned cycle (simple drill). Swap in any canned cycle you need (G82, G83, G84, etc.)
- G99 — Return to R plane after each hole
- X0 Y0 — Hole location
- R0.1 — Retract plane, 0.1″ above the part
- Z-1.0 — Drill depth
- F5.0 — Feedrate in inches per minute
X and Y can go on a separate line before the canned cycle call if you prefer. Always include the feedrate — don’t rely on whatever value was last active in the program.
G99 Code Example
This example uses a counterbore canned cycle and switches between G99 and G98 to show how they work together.
N1 G90 G54 G00 X0 Y0 (Absolute mode, work offset, rapid to first position)
N2 G43 H01 Z5.0 M08 (Tool length comp, initial point Z5.0, coolant on)
N3 G82 G99 Z-3.0 R1.0 P500 F50.0 (Counterbore cycle, return to R plane)
N4 X10.0 (Drill hole at X10 — retracts to R1.0)
N5 G98 X20.0 (Drill hole at X20 — retracts to initial point Z5.0)
N6 G99 X30.0 (Back to R plane return for final hole)
N7 G80 (Cancel canned cycle)
Line by line:
N2 establishes Z5.0 as the initial point. Even though G99 won’t return there, you still need a safe starting height above your fixture.
N3 starts the counterbore canned cycle with G99. The tool returns to R1.0 after each hole. P500 is a 500-millisecond dwell at the bottom of the hole. F50 is feedrate in mm/min.
N4 drills the second hole at X10.0. Because G82 is a modal canned cycle, it repeats with the same parameters. The tool retracts back to R1.0.
N5 switches to G98. After drilling this hole at X20.0, the tool returns all the way to Z5.0. Use this when there’s a clamp or obstacle the tool needs to clear on the way to the next position.
N6 switches back to G99 for the final hole at X30.0 — faster retract, no obstacles.
N7 cancels the canned cycle with G80.
What Does G99 Do on a Lathe?
G99 works completely differently on a CNC lathe.
On a lathe, G99 sets the feedrate mode to feed per revolution. So if you program F0.010 with G99 active, the tool advances 0.010 inches for every full rotation of the spindle.
Feed per revolution is the standard for turning operations because the cut depth stays consistent regardless of spindle speed.
G98 on a lathe sets feedrate to feed per minute — the tool moves at a fixed rate regardless of spindle speed. Less common for turning, but used in some applications.
If you’re reading lathe programs, don’t mix these up — G98/G99 on a lathe have nothing to do with canned cycle retract planes.
FAQS
Is G99 the default on most CNC controls?
No. On most Fanuc-based controls, G98 is the default at power-on and after a reset. G99 needs to be programmed explicitly.
It’s good practice to state it clearly in your code so the intent is obvious — especially if someone else is reading your program.
Is G99 a modal command?
Yes. G99 is a modal command, which means it stays active until you switch to G98 or cancel the canned cycle with G80. It only affects canned cycle operations — it has no effect on rapid moves (G00), linear moves (G01), or circular moves (G02/G03).
When should I use G99 instead of G98?
Use G99 when the path between holes is clear — no clamps, fixtures, or raised features between positions. G99 keeps the tool closer to the part, which reduces travel time and shortens cycle time. If there’s any doubt about obstacles, use G98. The extra travel time is worth it to avoid a crash.
Can I use G98 and G99 in the same program?
Yes. Because both are modal, you can switch between them mid-program. A common approach: use G99 between holes where the path is clear, then switch to G98 before holes near clamps or fixture edges. Just make sure you know the tool path before running it on the machine.