G98 vs G99: Controlling Return Positions in CNC Canned Cycles
When using canned cycles like G81, G83, or G84, the CNC machine needs to know where to return after completing a drilling move. That’s where G98 and G99 come in.
These two G-codes define whether the tool returns to the initial point or the R-plane after drilling — and understanding them is crucial for both speed and collision avoidance.
🧭 What They Do
| G-Code | Return To | Best Use Case |
|---|---|---|
G98 | Initial point (Z before cycle) | When obstacles exist (safe retract) |
G99 | R-plane (Retract height) | For faster, efficient retraction |
🔧 Basic Example with G98
G90 G81 Z-15 R2 F150 G98
X10 Y10
X20 Y10
G80
- The tool will drill to Z–15, retract up to initial Z (e.g., Z10).
- Useful when there are clamps, fixtures, or part geometry that might block a short retract.
⚡ Faster Operation with G99
G90 G81 Z-15 R2 F150 G99
X10 Y10
X20 Y10
G80
- Tool drills to Z–15, retracts only to R2 (2 mm above surface), not all the way up.
- Saves time in deep hole drilling or production environments.
🧠 When to Use Which?
| Situation | Use G-Code |
|---|---|
| Tight fixtures/clamps above the part | G98 |
| Open part surface, speed is priority | G99 |
| Drilling near walls or vice jaws | G98 |
| High-volume production with clearance | G99 |
⚠️ Important Safety Note
- If you mistakenly use
G99when the tool should avoid an obstacle, you risk a crash. - Always simulate and dry-run programs that switch between G98/G99.
🧪 Full Example with G98 and G99
G90 G54
G00 X0 Y0 Z10
(Use G98 to return to safe height)
G98 G81 Z-10 R2 F100
X10 Y0
X20 Y0
G80
G00 Z10
(Use G99 to return only to R-plane)
G99 G83 Z-25 R1 Q4 F80
X30 Y0
X40 Y0
G80
🧷 CAM Software Behavior
Most modern CAM software (Fusion 360, Mastercam, etc.) will:
- Default to
G99for speed - Allow toggling
G98for safety zones - Let you choose per operation (or even per hole)
✅ Best Practices
- Always check the clearance needs of your part setup
- Default to
G98during prototyping or when unsure - Use
G99in proven production environments - Combine with
G43,G28, orsafe Z retractsif needed
🧠 Summary
| Code | Return Height | Speed | Safety |
|---|---|---|---|
| G98 | Initial point (Z before cycle) | Slower | Safer |
| G99 | R-plane (R value) | Faster | Needs clearance check |
Leave a comment