G90 vs G91: Absolute vs Incremental Positioning in CNC
G90 (absolute) and G91 (incremental) are the two modes that define how your CNC machine interprets coordinate values. G90 tells the machine to move TO a specific coordinate measured from the part zero point. G91 tells the machine to move BY a specific distance from wherever the tool currently is. Understanding this difference is essential because using the wrong mode will crash your tool.
The Core Difference
| G90 (Absolute) | G91 (Incremental) |
|---|---|
| Coordinates from a fixed origin (zero point) | Coordinates from the current tool position |
| G90 G01 X50 moves TO X=50 | G91 G01 X50 moves BY +50mm from current |
| Safer for most programming | Useful for repeats and subprograms |
| One wrong coordinate = one wrong position | One wrong coordinate = everything shifts |
| Easier to debug and read | Harder to debug, position-dependent |
The key insight: in G90 every coordinate is an absolute location on the part. In G91 every coordinate is a relative distance from where the tool is right now. The same program produces completely different motion depending on which mode is active.
How Each Mode Works
G90 — Absolute Positioning
In absolute mode every coordinate is measured from the workpiece zero point, which is set by your work offset (G54). The tool goes to the exact X, Y, Z position you specify regardless of where it started.
; Tool starts at X=25, Y=25
G90 G01 X50 Y50 F200
; Tool moves FROM (25,25) TO (50,50)
; X50 means "go to position 50 on the X axis"
G01 X100 ; Tool moves FROM (50,50) TO (100,50)
G01 Y0 ; Tool moves FROM (100,50) TO (100,0)
G01 X0 ; Tool moves FROM (100,0) TO (0,0)
Each coordinate is independent. If you tell the tool to go to X=50 it goes to X=50 whether it was at X=25 or X=75 before.
G91 — Incremental Positioning
In incremental mode every coordinate is a distance from the current tool position. The tool moves by the specified amount.
; Tool starts at X=25, Y=25
G91 G01 X50 Y50 F200
; Tool moves FROM (25,25) TO (75,75)
; X50 means "move +50mm from where you are now"
G01 X50 ; Tool moves another +50mm to X=125
G01 Y50 ; Tool moves another +50mm to Y=125
G01 X-50 ; Tool moves -50mm to X=75
The same G91 X50 means something different every time you use it because the starting position changes.
Visual Comparison
G90 (Absolute) G91 (Incremental)
───┬───┬───┬───┬─── ───┬───┬───┬───┬───
0 25 50 75 100 0 25 50 75 100
↑ ↑
Tool at X=25 Tool at X=25
│ │
G90 X75→→→→→► G91 X50→→→→→►
│ │
▼ ▼
Tool at X=75 Tool at X=75
(absolute: go TO X=75) (incremental: move +50)
When to Use Each Mode
Use G90 (Absolute) When:
- Writing main programs for production parts
- Positioning from part zero reference point
- Most milling and drilling operations
- You are a beginner learning CNC programming
- Debugging programs that are not working correctly
Use G91 (Incremental) When:
- Writing subprograms (M98/M99) that run at multiple positions
- Creating repeating patterns like bolt hole circles
- Writing probing routines that move relative to the probe
- Moving to a tool change position from any location
Programming Patterns
Bolt Hole Pattern with G90
G90 G54 G00 X0 Y0 Z5
G81 R2 Z-10 F150
X0 Y0 ; Hole 1 at (0,0)
X50 Y0 ; Hole 2 at (50,0)
X50 Y50 ; Hole 3 at (50,50)
X0 Y50 ; Hole 4 at (0,50)
G80
Each hole position is independent. Changing one coordinate does not affect the others.
Subprogram with G91
O1000 ; Subprogram for one pocket
G91 G01 Z-1 F100
X25
Y25
X-25
Y-25
G00 Z2
G90 ; Switch back before returning
M99
This subprogram cuts the same pocket shape regardless of where the tool started.
Common Mistakes
Mistake 1: Forgetting to Switch Back
The most expensive G91 mistake is returning from a subprogram without switching back to G90. Every coordinate in the main program is then interpreted incorrectly.
Fix: Always end subprograms with G90 before M99.
Mistake 2: Not Including G90 in the Safety Block
If the previous program left G91 active and your program does not include G90, every move is interpreted incrementally.
Fix: Start every program with G90 G94 G17 G54.
Mistake 3: Confusing G91 with G92
G91 changes coordinate interpretation. G92 shifts the entire coordinate system. They sound similar but do completely different things.
Fix: G91 affects how coordinates are read. G92 affects where zero is located.
Testing Which Mode Is Active
G00 X0 Y0 Z5 ; Move to known position
G91 G00 X10 ; Move 10mm in X
G90 G00 X0 ; Return to X0
If the machine returns to the original position the modes are working. If it stops at X=10, G91 was not properly cancelled.
Summary
- G90 = coordinates from fixed zero. Use by default. Safer for beginners.
- G91 = coordinates from current position. Use for subprograms and patterns.
- Always set G90 in your safety block at the start of each program.
- Always switch back to G90 at the end of subprograms.
- When in doubt, use G90.
What’s Next?
Detailed Examples with Real Numbers
Example 1: Milling a Rectangle
You need to cut a 100mm by 60mm rectangle starting from the bottom-left corner.
Using G90:
G90 G01 X0 Y0 F200 ; Start at (0,0)
G01 X100 ; Move TO X=100
G01 Y60 ; Move TO Y=60
G01 X0 ; Move TO X=0
G01 Y0 ; Move TO Y=0
Using G91:
G91 G01 X0 Y0 F200 ; No movement (0 from current)
G01 X100 ; Move +100mm in X
G01 Y60 ; Move +60mm in Y
G01 X-100 ; Move -100mm in X
G01 Y-60 ; Move -60mm in Y
Both programs cut the same rectangle. The G90 version is easier to read because each line tells you the exact position. The G91 version requires you to track the current position mentally.
Example 2: Drilling a Row of Holes
You need to drill five holes spaced 20mm apart starting at X=10.
Using G90:
G90 G81 X10 Y0 Z-10 R2 F150
X30 ; Hole 2
X50 ; Hole 3
X70 ; Hole 4
X90 ; Hole 5
G80
Using G91:
G91 G81 X10 Y0 Z-10 R2 F150
X20 ; Move +20mm from hole 1
X20 ; Move +20mm from hole 2
X20 ; Move +20mm from hole 3
X20 ; Move +20mm from hole 4
G90 G80
The G90 version is clearly superior for this application. Each hole position is independently specified and easy to verify.
How CAM Software Handles G90 and G91
Most CAM software generates programs in G90 absolute mode by default. The post-processor automatically includes G90 in the program header. You rarely need to think about G90 versus G91 when working with CAM-generated code.
The main exception is when you manually edit or add code to CAM-generated programs. If you insert G91 moves without understanding the context, you can break an otherwise correct program. Always verify the active mode before and after any manual edits.
G91 in Subprograms
The most common and appropriate use of G91 is in subprograms that are called from multiple positions. A subprogram written in G91 runs identically regardless of where the tool starts because every move is relative.
Example: Pocket Subprogram
; Main program
G90 G54 G00 X0 Y0 Z5
M98 P1000 ; Cut pocket at position 1
G90 G00 X100 Y0
M98 P1000 ; Cut pocket at position 2
G90 G00 X100 Y100
M98 P1000 ; Cut pocket at position 3
M30
; Subprogram (same pocket, different positions)
O1000
G91 G01 Z-1 F100
G01 X50 F200
G01 Y50
G01 X-50
G01 Y-50
G00 Z2
G90 ; CRITICAL: switch back before returning
M99
Without the G90 before M99, the main program coordinates would be interpreted incrementally, causing the second and third pockets to be cut at wrong positions.
Debugging G90 vs G91 Problems
If your machine moves to unexpected positions, the most likely cause is an incorrect G90/G91 mode. Follow these diagnostic steps:
- Check the safety block at the top of the program. Does it contain G90?
- Check all subprograms. Does each one end with G90 before M99?
- Check for G91 anywhere in the program that might not be followed by G90.
- If you find a missing G90, add it and test again.
- If the problem persists, run the program in single-block mode and verify each position manually.
G91 for Tool Change Positioning
Some programmers use G91 to move to a tool change position relative to the current location:
G91 G00 Z100 ; Move Z up 100mm from current position
M06 T2 ; Change tool
G90 ; Switch back to absolute
This is safer than using absolute coordinates because the tool always retracts by the same amount regardless of where it was cutting.
G90 in the Safety Block
Every CNC program should start with a safety block that explicitly sets all modes including G90:
G90 G94 G17 G54 ; Absolute, feed/min, XY plane, offset 1
G21 ; Metric mode
This single line prevents the most common class of CNC crashes by ensuring the machine starts in a known state. All experienced CNC programmers use this pattern.
G90 vs G91 in Multi-Part Production
When machining multiple identical parts from one block of material, G90 and G91 each have advantages. G90 makes it easy to specify each part location independently by changing the coordinates. G91 makes it easy to repeat the same toolpath by calling a subprogram at each location.
For production runs the best approach is to use G54 through G59 work offsets for each part position and write the program in G90. This combines the safety of absolute mode with the flexibility of multiple part positions.
G91 in Probing Routines
Probing cycles are one area where G91 is clearly the right choice. A probe touch cycle should always move relative to the probe starting position, not to an absolute coordinate:
G91 G31 Z-20 F50 ; Probe downward from current position
G90 G00 Z5 ; Retract to safe height
Using G91 for probing ensures the probe moves the same distance regardless of where it started.
G92 and Its Relationship to G90/G91
G92 is often confused with G91 but they do different things. G92 sets a temporary offset that shifts the zero point for all following coordinates. G91 changes how coordinates are interpreted.
G92 X0 Y0 Z0 ; Make current position the new zero
G90 G01 X50 F200 ; Move 50mm from the new zero
G92 should be used sparingly because it creates confusion about where zero actually is. Use G54-G59 work offsets instead.
Common Questions
Can I switch between G90 and G91 in the same program?
Yes, you can switch freely. Just be aware that every time you switch, the coordinate interpretation changes. Always include a comment indicating which mode is active.
Does CAM software use G90 or G91?
CAM software almost always generates G90 code. The post-processor includes G90 in the program header automatically.
Which mode do professional CNC programmers use?
Professional programmers use G90 for main programs and G91 for subprograms and probing routines. G90 is the default choice because it is safer and easier to debug.
What happens if I forget G90?
If neither G90 nor G91 is specified, the machine uses whatever mode was active from the previous program. This is why the safety block is important — it sets the mode explicitly.
Practical Tips for Beginners
Always start with G90. Until you are comfortable with both modes, write all your programs in G90. It is safer and easier to debug. You can add G91 later when you understand subprograms.
Use comments to track mode changes. Every time you switch modes, add a comment explaining what is happening:
G91 ; Switch to incremental for subprogram
G01 X10
G90 ; Back to absolute
Verify with simulation. Before running any program that uses G91, simulate it in a G-code simulator. Watch the toolpath carefully to verify the mode changes produce the expected motion.
Learn by modifying. Take existing programs and convert them between G90 and G91. This exercise builds understanding of how each mode works.
Summary of Key Differences
| Aspect | G90 | G91 |
|---|---|---|
| Coordinate reference | Fixed zero point | Current position |
| Safety level | Safer for beginners | Risky if misunderstood |
| Debug difficulty | Easy — each line stands alone | Hard — position dependent |
| Best use | Main programs | Subprograms and probing |
| CAM software | Default mode | Rarely used |
| Modal | Yes | Yes |
Understanding G90 and G91 is fundamental to CNC programming. Master these two codes and you will have a solid foundation for every other G-code you learn.
G90 and G91 in the Real World
In a typical production shop, G90 is used for 95 percent of all programming. The main programs are always in G90 for safety and readability. G91 is reserved for subprograms, probing cycles, and specific situations where relative positioning simplifies the code.
When you are starting out, focus on mastering G90. Write all your early programs in absolute mode. Once you are comfortable reading and writing G90 programs, add G91 to your skills by writing subprograms for repeated features.
The single most important habit to develop as a new CNC programmer is always including G90 in your safety block at the top of every program. This one practice prevents more crashes than any other programming technique.
G90 and G91 are simple concepts with significant practical implications. Taking the time to understand them fully will prevent the most common cause of CNC crashes. With practice, switching between G90 and G91 becomes second nature. Always verify your mode with a safety block and use comments to track changes, and you will avoid the most common CNC programming mistakes.
These two simple G-codes form the foundation of every CNC program you will ever write. Master them early and the rest of CNC programming becomes much easier.
Bookmark this guide and refer back to it whenever you need a refresher on G90 and G91 differences. Understanding these two modes is the key to confident CNC programming. It takes practice.

G-Code Explained: How CNC Programming WorksJune 25, 2026 · Tutorials
G-Code for Beginners: Learn to Write Your First CNC ProgramJune 25, 2026 · Tutorials
G00 and G01: Rapid Traverse and Linear InterpolationJune 25, 2026 · Tutorials
CNC Conversational Programming Guide: A Beginner's IntroductionJune 27, 2026 · Tutorials