CNC Milling | G90 and G91 Codes | Absolute and Incremental Modes


A dimension in either input units must have a specified point of reference. For example, if X35.0 appears in the program and currently selected units are millimeters, the statement does not indicate where the dimension of 35 mm has its origin. Control system needs more information to interpret dimensional values correctly, as intended.

There are two types of references in CNC programming:

  • Reference to a common point on the part (known as the origin for ABSOLUTE input)
  • Reference to a previous point on the part (known as the last tool position for INCREMENTAL input)

In the example, X35.0 dimension (and any other as well) can be measured from a selected fixed point of the part, called origin, or program zero, or program reference point – all these terms have the same meaning. The same value of X35.0 can also be measured from the previous position, which is always the last tool position. This position then becomes the current position for the next tool motion. Control system cannot distinguish one of the two possibilities from the X35.0 statement alone, and some other description must be added to the program.

All dimensions in a CNC program measured from the common point (origin) are absolute dimensions, as illustrated in Figure 11-1, and all dimensions in a program measured from the current position (last point) are incremental dimensions, as illustrated in Figure 11-2.

Figure 11-1
Absolute dimensioning – measured from part origin
G90 command will be used in the program Figure 11-2
Incremental dimensioning – measured from the current tool location
G91 command will be used in the program
Absolute dimensions in a program represent target locations of the cutting tool from origin.
Incremental dimensions in a program represent the actual amount and direction of the cutting tool motion from the current location.

Since the dimensional address X, written as X35.0, is programmed the same way for either point of reference, some additional means must be available to the programmer. Without them, the control system would use default system parameter setting, not always reflecting the programmer’s intentions. Selection of the dimensioning mode is controlled by two modal G commands.

G90 and G91 Commands

There are two preparatory commands available for the input of dimensional values – G90 and G91 – to distinguish between two available modes:

G90 : Absolute mode of dimensioning
G91 : Incremental mode of dimensioning

Both commands are modal, therefore they will cancel each other. The control system uses an initial default setting when powered on, which is usually the incremental mode. This setting can be changed by a system parameter that presets the computer at the power startup or a reset. For individual CNC programs, system setting can be controlled by including the proper preparatory command in the program, using either one of two available commands – G90 or G91.

It is a good programming practice to always include any required setting in the CNC program, and not to count on any default control system settings. It may come somewhat as a surprise that the common default control setting is the incremental mode, rather than the absolute mode. After all, absolute programming has a lot more advantages than incremental programming and is far more popular. In addition, even if incremental programming is used frequently, every program still starts up in the absolute mode. So, the question is why the incremental default? There is a good reason for it – as in many cases of defaults – machining safety. Follow this reasoning:

Consider a typical start of a new program loaded into the machine control unit. Control had just been turned on, part is safely mounted, current cutting tool is at the home position, offsets are set and the program is ready to start. Such a program is most likely written in more practical absolute mode. Everything seems fine, except that the absolute G90 command is missing in the program. What will happen at the machine? Think before an answer and think logically.

When the first tool motion command is processed, the chances are that its target values will be positive or have small negative values. Because any dimensional input mode is missing in the program, control system ‘assumes’ the mode as being incremental, which is the normal default value stored in a system parameter. The active tool motion, generally in X and Y axes only, will take place to either the over travel area, in the case of positive target values, or by a small amount, in case of negative target values. In either case, the chances are that no damage will be done to the machine or the part. Of course, there is no guarantee, so always program with safety in mind.

G90 Code – Absolute Data Input

In absolute programming mode, all dimensions are measured from the point of origin. Origin is the program reference point, also known as program zero. Actual motion of the machine is the real difference between the current absolute tool position and its previous absolute position. Algebraic signs [+] plus or [-] minus refer to the quadrant of rectangular coordinates, not the direction of motion. Positive sign does not have to be written for any address. All zero values, such as X0, Y0 or Z0 refer to the tool position at program reference point, not to the tool motion itself. Zero value of any axis must be written when such tool position is required.

The preparatory command G90, selected for absolute mode setting, remains modal until the incremental command G91 is programmed. In absolute mode, there will be no motion for any axis that is omitted in the program.

Probably the main advantage of absolute programming is ease of modification by either the programmer or CNC operator. A change of one dimension does not effect any other dimension in the program.

For CNC lathes with Fanuc controls, the common representation of the absolute mode is the axis designation as X and Z, without the G90 command. If available, rotation axis uses the address C in absolute mode. Some lathes may use the G90 command, but not those with Fanuc controls.

G91 Code – Incremental Data Input

In incremental mode of programming, also called a relative mode, all program dimensions are measured as departure distances into a specified direction (equivalent to ‘distance-to-go’ on the control system). Actual motion of the machine is the specified amount along each axis, with the direction indicated as positive or negative.

The signs + or – specify direction of the tool motion, not the quadrant of rectangular coordinates. Plus sign for positive values does not have to be written, but minus sign must be used. All zero input values, such as X0, Y0 or Z0 mean there will be no tool motion along that axis, and do not have to be written at all. If a zero axis value is programmed in incremental mode, it will be ignored. The preparatory command for incremental mode is G91 and remains modal until the absolute command G90 is programmed. There will be no motion of any axis omitted in the program block.

The main advantage of incremental programs is their portability between individual sections of a program. An incremental program can be called at different locations of the part, even in different programs. It is mostly used when developing subprograms or repeating an equal distance.

For Fanuc controlled CNC lathes, the most common representation of the incremental mode is the axis designation as U and W (for X and Z respectively), without the G91 command. If available, rotation axis uses the address H in incremental mode. Some lathes may use the G91 command, but not those with Fanuc controls.

Combinations in a Single Block

On most Fanuc controls, absolute and incremental modes can be combined in a single program block for special programming purposes. This may sound rather unusual, but there are significant benefits in this advanced application. Normally, a block is in one mode only – either in absolute mode or in incremental mode. On many controls, for any change over to the opposite mode, motion command must be programmed in a separate block. Such controls, for example, do not allow programming incremental motion along one axis and absolute motion along the other axis within the same block.

Most Fanuc control systems do allow programming both modes within the same block. Just specify G90/G91 preparatory command before each significant address.

For lathe work, where G90 and G91 are not used, the change over is between X and U axes and Z and W axes. The X and Z contain absolute values, U and W are incremental values.

G90 and G91 Codes Examples

Both types can easily be written within the same block. Here are two typical examples:

Milling Example (G21 in effect)

N68 G01 G90 X125.3 G91 Y45.15 F185.0;

The milling example shows a motion where the cutter has to reach absolute position of X125.3 mm and – at the same time – has to move along the Y axis by specified distance of 45.15 mm in the positive direction. Note the actual position of the G90 and G91 commands in the block – it is very important, but it may not work on all controls.

Turning example (G20 in effect):

N60 G01 X13.56 W-2.5 F0.013;

This example for a CNC lathe shows a tool path motion, where the cutting tool has to reach diameter of 13.56 inches and – at the same time – has to move 2.5 inches into the negative Z axis direction, represented by incremental designation address W. G90 or G91 is not normally used, when Group A of G codes is used (this is the most common G code group).
Anytime there is a switch between absolute and incremental mode in a CNC program, part programmer must be careful not to remain in the ‘wrong’ mode longer than needed. The switch between modes is usually temporary, for specific purpose and may affect one or more blocks. Always reinstate the original program setting. Remember that both absolute and incremental modes are modal – they remain in effect until canceled by the opposite mode.