G-codeUnits & ModesModal group 3Mill · Lathe · 3D printer
G90 & G91: Absolute and Incremental Positioning
G90 makes a coordinate a position measured from the work zero, so X50. is 50mm from the corner of the part no matter where the tool is standing. G91 makes the same word a distance to travel from wherever the axis is now, so X50. goes 50mm further along. Both are modal and both live in the same group, so the last one written holds until the other replaces it. Nearly everything is written in G90. Incremental earns its place in three jobs: repeating a pattern, stepping down inside a loop, and retracting to machine home.
Syntax
G90 Coordinates are positions, measured from the active work offset zero
G91 Coordinates are distances, measured from the current position
G90 G00 X0. Y0. Rapid to part zero
G91 G00 X25. Rapid 25mm along X from wherever the axis standsParameters
Neither code takes an address of its own. What changes is how every other word on the block gets read, and the words that catch people out are the ones in a canned cycle.
| Word | Under G90 | Under G91 |
|---|---|---|
X Y Z | Position in the live work coordinate system | Distance and direction from the current position |
R in a canned cycle | Height of the retract plane | Distance from the initial level down to the retract plane |
Z in a canned cycle | Height of the hole bottom | Distance from the retract plane down to the hole bottom |
K repeat count | Repeats the cycle at the hole it is already at | Repeats the cycle one increment further along each time |
A B C | Angular position of the rotary axis | Angle to turn through from where it sits |
I J K on an arc | Vector from the arc start point to its centre | The same vector. Arc centres do not follow the mode |
Example
O0010 (END PLATE, 12MM 6082, LINE OF 8 HOLES AT 25MM PITCH)
G21 G17 G40 G49 G80 G90 (safe start block, absolute)
T02 M06 (5.1mm HSS-Co drill, M6 tapping size)
G54
S3600 M03 (58m/min, 0.1mm/rev)
G00 X20. Y25. (first hole, measured from part zero)
G43 H02 Z25. M08 (tool length comp on, flood coolant)
G99 G81 Z-14.5 R2. F360 (12mm plate, 1.5mm of drill point, 1mm clear of the back face)
G91 X25. K7 (seven more holes, 25mm apart, last one lands at X195.)
G80 (cycle off before the motion mode comes back)
G90 (absolute again, on a line of its own)
G00 Z25. M09
M05
G91 G28 Z0. (nothing to travel to the intermediate point, then Z home)
G90 (hand the next program an absolute control)
M30Controller differences
| Control | Behaviour |
|---|---|
| Fanuc | Mills read the pair as above. Turning centres shipped in G code system A, which is most of them, have no G90/G91 mode at all: there G90 is the outer and inner diameter cutting cycle, and absolute against incremental is the address itself, X and Z for positions, U and W for distances. G code systems B and C restore the mill meaning. |
| Haas | Mills match Fanuc, except that a canned cycle repeat is L rather than K. The lathes follow the Fanuc system A pattern, so G90 on a Haas turning centre is the O.D./I.D. turning cycle and a mill start block pasted into a lathe program calls it. |
| Siemens 840D | The native language has G90 and G91, and it also lets one word ignore the mode: X=AC(50) is absolute inside a G91 block and X=IC(10) is incremental inside a G90 block, without changing what is modal. A post that uses them produces code no Fanuc will read. |
| Mazak | EIA/ISO programs on the mills work as on Fanuc, and turning programs carry the same G code system question. A Mazatrol conversational program has no mode word: the shape coordinates belong to the unit. |
| Grbl | Both codes are supported, but arc centre mode is not. Only the incremental form, G91.1, is in the supported list, so an arc posted with absolute I and J centres stops the stream instead of cutting. A soft reset puts the parser back to G90, which changes what a resumed job does. |
| Marlin | G90 and G91 cover X, Y, Z and the extruder together, and the extruder also has its own pair: M82 for absolute E, M83 for relative E. The last one written wins for E, so the E axis runs in a different mode from the other three without anything in the program looking wrong. |
What goes wrong
Every hole 25mm out from the drawing means a G91 was still live. The pattern runs, nobody writes G90 under it, and the next positioning block adds its X and Y to wherever the tool finished instead of measuring from part zero. The move that should cross to X40. Y110. goes to X235. Y135. and finds a clamp or the end of travel. Put G90 on its own line under the last incremental block, not only in the start block.
Second is the repeat count read in the wrong mode. G91 X25. K7 is the whole reason to switch, but leave G90 live on that block and a Fanuc drills the same hole seven times over: the drill pecks air at the bottom of a finished hole, the cycle time triples, and the part passes inspection so nobody looks.
Third is G90 on a lathe. In G code system A it is the outer and inner diameter cutting cycle, not a mode, and Haas turning centres read it the same way. A mill safe start line pasted into a turning program fires a cycle with whatever X, Z and F were modal.
Fourth, an incremental program cannot be restarted. Stop at hole 30 of 48 to change an insert and there is no block to start from, because every position depends on the one before it. One mistyped increment shifts every hole after it too, not just its own.
Last, an offset change under G91 does nothing. G55 followed by incremental moves stays in the old fixture, because the new zero only shows up on the first absolute coordinate.
Updated 28 Sep 2026