G91 CNC Code Explained: An Easy Intro for Beginners [Incremental Positioning]

What does a G91 code do?

A G91 code sets the CNC to incremental positioning mode.

This means that the CNC will interpret all location values as relative to the position of the machine before making the move.

The zero location of the machine will move each time the machine moves. This can be good for repetitive work such as drilling a series of holes.

Learn CNC Programming – It’s Easier Than You Think!

Learning G Code doesn’t have to be difficult…

If you know what to focus on.

Join our simple, easy-to-follow course, “G Code Made Easy: CNC Programming for Beginners“. We walk you through all the important codes – with simple explanations and real-world examples.

Want to become a super-skilled CNC programmer? Join now to take the shortcut to becoming a G Code Master today!

Make Learning G Code Easy

G90 vs G91: CNC positioning modes

CNC machines have two positioning modes available.

They are absolute positioning using the G90 code and incremental positioning using the G91 code.

As noted above, incremental positioning with G91 will take all locations relative to the machines current location.

With absolute positioning (G90), the machine will interpret all locations as relative a static location. This will usually be the work offset zero location as set by the G54 code or the machines home location if no work offset is active.

G90 and G91 are both modal codes.

Modal codes stay active until they are either canceled or changed. For G90 and G91, there is no cancel code so the only way to change them is to call the opposite code.

graph paper example of incremental positioning with multiple points as examples
graph paper example of absolute positioning with multiple points as examples

The images above show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.

Notice how in absolute mode, all locations are relative to a single location, usually either the workpiece zero or machine home location. 

In incremental mode, all locations are relative to the machine’s current location.

When to use a G91 code

The main portion of most programs will be in absolute mode (G90).

Incremental mode (G91) is usually only used to create repetitive features such as drilling a set of holes.

G91 is a much less frequently used code compared to G90.

G90 codes are used frequently. This is because they get used as part of safety lines of code sometimes called safety block.

Safety lines are a chunk of code that is used to ensure that the machine is in the correct modes before executing a section of the CNC program.

They are used at the start of new sections of code such as when changing tools or when starting a new machining operation.

Why using a G91 code is important

Both G90 and G91 are modal commands which means that they will stay in effect until changed or canceled.

It is important to set your positioning mode in your program with either G90 (absolute mode) or G91 (incremental mode).

Imagine if you had an operation where you were going to drill a set of holes. Before you drill those holes, it would be wise to set all the necessary modes you will need to have active.

Setting the positioning mode (absolute or incremental), setting the type of units you are in (inches or mm) and turning on various compensation modes are just some of the modes that you might want to have set.

If these modes are already active, then nothing will change. No harm, no foul.

If they weren’t active and you didn’t turn them on, you might crash your machine.

When writing your CNC programs, it is critical to be in the correct positioning mode at all times. For this reason, a G90 or G91 code should be used at the start of a new section of the program.

What to think about when using a G91 code

Know where you are at and where you want to move the machine.

In other words, you need to know where the start and stop location of each move is.

The main body of most programs will be written in absolute mode (G90). This is because it is easier to visualize a part based on absolute coordinates.

Portions of a program get written in incremental mode. Often incremental mode is used when dealing with canned cycles or subprograms.

You can make your whole program in incremental mode if you wish, most people don’t though.

CNC codes that are similar to G91

We already discussed the most common code that is similar to G91. G90 sets the machine in absolute positioning mode.

The other main codes that affect positioning are G60 and G64.

G60 sets the CNC to single direction positioning mode.

The G60 code will make force the machine to approach each new location from the same direction. This decreases location errors that can occur because of backlash in the machine.

G64 is normal positioning mode. In normal positioning mode, the machine will move all axes at the same time and will approach the workpiece form whichever side is fastest.

Want to learn more about CNC G Code?

Leave a Comment