G90 and G91: Absolute and Incremental Positioning
G90 reads coordinates as positions measured from the work zero. G91 reads them as distances from wherever the tool is now.
G90 and G91 decide what the numbers in a move mean.
- G90 (absolute): coordinates are positions measured from the work zero set by the active work offset, such as G54.
G1 X10goes to X10, wherever the tool starts. - G91 (incremental): coordinates are distances from the tool's current position.
G1 X10moves 10 in +X from wherever the tool is now.
Both are modal: the mode stays active until the other code replaces it. Almost every CAM program runs in G90 and sets it in the first few lines.
When to use G91
- Repeated patterns. A shape written in incremental moves can be cut anywhere: position the tool in G90, then run the same G91 moves. Subprograms often use this to repeat a feature.
- Moving relative to where the tool is. For example, stepping down another 0.5 mm, or backing away from a wall.
- Going home safely.
G91 G28 Z0is the classic way to send Z straight up to the G28 reference position, because in G91 Z0 means "don't move Z" for the intermediate point.
The risk: staying in G91
The usual G91 mistake is forgetting to switch back. After a G91 block, every later coordinate is still read as a distance, so a G0 Z10 meant as "go to 10 above the part" becomes "move up 10 from here", and the next X and Y moves land in the wrong places. Put G90 back as soon as the incremental moves are done, and set G90 at the start of every program.
Example: position absolutely, cut a square incrementally
The program moves to X10 Y10 in G90, then switches to G91 and cuts a 20 mm square with four relative moves. It switches back to G90 before retracting.
(G90 and G91 example: position in absolute, then cut a square in incremental)
G21 G17 G90 G54
T1 M6 (6 mm flat end mill)
S12000 M3
(G90: X10 Y10 is a position measured from the work zero)
G0 Z10
G0 X10 Y10
G0 Z2
G1 Z-1 F200
(G91: each move below is a distance from where the tool is now)
G91
G1 X20 F600
Y20
X-20
Y-20
(Back to G90 before the retract, so Z10 is a height again)
G90
G0 Z10
M5
M30
Open it in CutViewer: the square runs from X10 Y10 to X30 Y30, even though the incremental lines only say 20.
Line by line:
G0 X10 Y10in G90 goes to the position X10 Y10.G91switches to incremental.G1 X20 F600moves 20 mm in +X, to X30.Y20,X-20andY-20move up, left and down by 20 mm, back to the start.G90beforeG0 Z10, so Z10 is a height above the work zero. Left in G91, the tool would move up 10 mm from Z-1, to Z9.
How CutViewer shows G90 and G91
CutViewer tracks G90 and G91 and draws each move from the right start point. The active distance mode is shown with the other modes for the current line. Canned drilling cycles work in G91 too: X and Y step from the current position, R is measured from the initial Z and Z from the R plane.
Frequently Asked Questions
What is the difference between G90 and G91?
In G90 absolute mode, X10 means "go to the position 10 from the work zero". In G91 incremental mode, X10 means "move 10 in the positive X direction from where you are". Most programs run in G90 and switch to G91 only for specific moves.
Which is the default, G90 or G91?
G90 on almost every control, but don't rely on it. Programs should set G90 at the start, because a program left in G91 by an earlier one would run every move from the wrong place.
Why do programs use G91 G28 Z0?
In G91, Z0 means "move zero in Z", so the intermediate point for G28 is the current position and the tool goes straight up to home. In G90, G28 Z0 would first go down to the work zero, which can crash.
Are I and J affected by G90 and G91?
Usually not. Arc centers given by I, J and K are incremental from the arc's start point by default, even in G90. Some controls switch them with G90.1 and G91.1 instead.
How do lathes do incremental moves?
Fanuc-style lathes using the standard (A) G-code system often use U and W for incremental X and Z moves instead of G91, so the same line can mix absolute and incremental words.
More G-Code Guides
Rapid positioning and straight cutting moves.
Clockwise and counter-clockwise arcs with I/J/K or R.
Pause for a set time, in seconds or milliseconds.
Choose the XY, XZ or YZ plane for arcs.
Inch or millimetre units for the program.
Return to home or a second reference position.
Cutter radius compensation, left, right and off.
Tool length offset on and off.
Work coordinate systems and machine coordinates.
Drilling canned cycles, from plain drilling to peck drilling.
Tapping cycle, and how to work out the feed rate.
Set the current position by shifting coordinates.
Feed per minute, per revolution, or inverse time.
Constant surface speed or a fixed spindle RPM.
Where a drilling cycle retracts between holes.
Spindle, coolant, tool change, stop and subprogram codes.
Check your own program before you cut: open it in CutViewer to see the toolpath in 3D, the run time and any problems.
Open CutViewer