Back to GSM Code List

G91: incremental coordinate programming

G91 makes every dimension measured from the current position of the tool instead of from part zero: X10. in G91 means ten millimeters past where you are, in the positive direction of the axis. It is modal and it is used in specific cases: the safe retract G91 G28 Z0., repeated patterns with K or L and geometry subprograms. Outside those, forgetting to go back to G90 is one of the commonest causes of a crash.

For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.

See the full data sheet for the family

Syntax by control

Fanuc / Haas (motion)

G91 G01 X25. Y0. F300

Every dimension is a signed increment from where the tool is. When the incremental stretch is over you have to go back to G90 explicitly: the control will not do it for you.

Fanuc / Haas (safe retract)

G91 G28 Z0.

The commonest use of G91: it takes the Z axis from wherever it is up to the reference point, with no intermediate point. The same block in G90 would go through the Z0 of part zero first, in other words through the face of the part.

Siemens 840D / 828D

G91 G1 X25 F300

Siemens also lets you give a single incremental dimension inside an absolute block with IC(): X=IC(25). That saves changing mode for one axis.

Heidenhain TNC (Klartext)

L IX+25 R0 F300

There is no modal G91: an I in front of the axis name marks that particular dimension as incremental. Dimensions without the I stay absolute inside the same block.

Address letters used with it

LetterWhat it setsUnit
X Y ZSigned increment from the current position. The sign gives the direction, not the side of the part.mm / in
Z and R in canned cyclesUnder G91 the R is measured from the current position of the axis and the Z is the depth measured from the R plane, not coordinates from part zero.mm / in
K / LCanned cycle repeats, which only have any effect in incremental mode: K on Fanuc, L on Haas. Each repeat applies the X and Y increment again.integer

Worked example

A row of five 5 mm holes spaced 25 mm apart in X, in a 14 mm plate. In absolute you would have to write all five coordinates; in incremental you program the cycle once and repeat it four more times with the 25 mm step. The holes end up at X20, X45, X70, X95 and X120.

G91 G28 Z0.
( Z to the reference point in incremental before the change. )
T4 M06
( 5 mm drill. )
G90 G54 G00 X20. Y30.
( The start point always in absolute: first hole of the row. )
G43 H04 Z25. M03 S2400
( T4 length offset and spindle on. Z25 becomes the starting position of the axis. )
M08
( Coolant on. )
G91 G99 G81 X0. Y0. Z-18. R-23. F180
( Cycle in incremental: R-23 drops 23 mm from Z25 down to the Z2 coordinate, and Z-18 is the depth measured from the R plane (Z2 to Z-16). X0 Y0 drills at the current position without moving. )
X25. K4
( Repeats the cycle four more times, stepping 25 mm in X each time. On Haas the repeat is written L4. In G90 this block would drill the same hole in the same place. )
G80 G90 G00 Z25. M09
( Cancels the cycle and goes back to absolute in the same block. Leaving G91 active here is the classic cause of an unexpected move in the next block. )
G91 G28 Z0. M05
( Safe retract in incremental and spindle stop. )
G90
( Leaves the control in absolute. )
M30
( End of program. )
Open the simulator to check the example

Practical keys to using G91 in the workshop

When it pays to program in G91

In three specific situations. First, the safe retract: G91 G28 Z0. takes the axis up from wherever it is without going through part zero. Second, repeated patterns: a row or a grid of holes is written once and repeated with K or L, which only work in incremental. Third, geometry subprograms reused at several positions: the subprogram carries the shape in incremental and the main program places it by positioning in absolute before each call. For everything else, absolute is safer and easier to debug.

How it works with canned cycles and with G90

In a canned cycle the change of mode changes the meaning of the R and of the Z: in incremental the R is measured from the current position of the axis and the Z is the depth from the R plane. So when you take a cycle from absolute to incremental you have to recalculate both, not just copy them. The shop rule that saves grief is to always close the incremental stretch with G80 G90 in the same block, and never leave a G91 active when you reach a tool change, the end of the program or a jump to a subprogram.

What incremental wins and what it loses

It wins on short, reusable programs: a twenty hole pattern fits in two blocks and the same subprogram serves four different positions. It loses on traceability, because to know where the tool is you have to add up every block before it, and on accumulated accuracy, because if the print is dimensioned in absolute and you chain rounded increments, the last point carries the sum of all the rounding. That is why prints dimensioned from a common origin are programmed in absolute and only the repeats are done in incremental.

Mistakes that cost you a part (or a tool)

  • Forgetting to go back to G90 after the incremental stretch: every following move adds to the current position and the tool ends up in the fixture or past the travel limits.
  • Writing G90 G28 X0. Y0. Z0. thinking it is the safe retract: under G90 the machine goes to part zero first, through the part or the clamps, and only then goes up to the reference point.
  • Taking a canned cycle to G91 without recalculating R and Z: in incremental the R is measured from the current position and the Z from the R plane, so the hole comes out at a different depth or the drill goes too far down.
  • Using K or L in absolute mode: the control drills the same hole in the same place as many times as you ask, with the drill dropping back into the hole it has already made.
  • Chaining incremental dimensions taken off a print dimensioned in absolute: every rounding accumulates and the last point falls out of tolerance without any single block looking wrong.
  • Ending the program in G91: if the control does not restore the modals by parameter, the next program or the first move at the handle starts in incremental.

Frequently Asked Questions (FAQ)

Why do you write G91 G28 Z0. and not G28 Z0.?

Because in G91 the intermediate point is the current position and the machine goes straight up to the reference point. In G90 that Z0. is the Z0 coordinate of part zero, in other words the face of the part: the tool comes down to it before going up. It is one of the commonest crashes on a mill.

When is G91 better than G90?

For repeated patterns with K or L, for reusable geometry subprograms and for retract moves. For the rest of the program, absolute is safer because an error in one block does not drag into the next ones.

Do errors build up when you program in incremental?

Yes, if the increments come from subtracting rounded dimensions off a print dimensioned in absolute. The control calculates with more decimals than you write, so the error is in the program, not in the machine. The fix is to program in absolute whatever the print dimensions in absolute.

Can I give one incremental dimension without changing mode?

On Siemens with IC() and on Heidenhain with the I in front of the axis, yes, axis by axis. On Fanuc and Haas no: you have to change mode with G91 and come back with G90, and that round trip is best done in the same block as the rest of the cancellation.

Does G91 change part zero?

No. The origin is still whatever G54 or whichever offset is active says: the only thing that changes is what the dimensions of each block are measured from. That said, a G10 L2 written with G91 active adds values to the offset instead of replacing them, and that does shift the zero.

Related codes

Related tools