CNC Coordinate Systems: G54-G59, G10, G54.1, & G52

Why change the Work Offset (Active Coordinate System) in a CNC program?

There are two main cases to “play around” with the coordinate systems in a G code program:

  1. When there are multiple blanks clamped in the machine pallet
  2. When a particular part has identical geometrical features repeated at different locations.

This post will explain all the G-Codes related to work offsets and coordinate systems.

G54 Multiple Coordiante Systems

G54 – G59 CNC codes: Work Offsets & Coordiante Systems

G54, G55, G56, G57, G58, and G59 (Usually referred to as “G54-G59“) are a group of CNC codes that specifies the “work offset” or the location of the workpiece on the machine’s table. They compensate for the workpiece’s position variations relative to the machine’s zero point. When the G54 (or G55, G56, etc.) code is executed, the CNC machine will use the new offset as a zero point for all the subsequent G-codes that follow. They are “modal commands,” and remain active until canceled by another G53 or a G54-G59 CNC code.

G54 is considered the 1st coordinate system, G55 the 2nd, and so on.

The syntax is simply G54. For example:

N10 G54; (select the 1st work offset)
N20 G56; (select the 3st work offset)

How does the machine know the positions of each coordinate system? The offset of each coordinate system relative to the machine datum is set either by parameters that can be edited on the controller’s monitor or by the G10 CNC code (see below)

G10 CNC Code: Setting zero points for G54-G59

G10 defines the coordinates of work offsets G54-G59.

The syntax is G10 Pn Xxx Yyy Zzz.

  • P: Work Offset number (1 – G54, 2 – G55, … , 6 – G59)
  • xx, yy, and zz: The coordinates of the work offset relative to the machine’s datum point.
N10 G10 P2 X250.0 Y250.0 (Setting the Datum of G58)
N20 G10 P2 X250.0 Y450.0 (Setting the Datum of G59)

Example: Pallets with multiple blanks (G10 & G54-G59)

Gcode Coordinate Systems G54 - G59

A common practice in CNC Milling is to place multiple blanks on a pallet and have the machine manufacture them together. This technique saves machining time and workload on the operator. The same CNC program executes multiple times, and the program’s datum shifts between the blank locations.

CNC Program

N10 G10 P1 X50.0 Y50.0 (Setting the Datum of G54)
N20 G10 P2 X50.0 Y250.0 (Setting the Datum of G55)
N30 G10 P2 X50.0 Y450.0 (Setting the Datum of G56)
N40 G10 P1 X250.0 Y50.0 (Setting the Datum of G57)
N50 G10 P2 X250.0 Y250.0 (Setting the Datum of G58)
N60 G10 P2 X250.0 Y450.0 (Setting the Datum of G59)
N70 G54; (Switched the Datum 0,0 to the origin of the 1st pallet)
N80 M98 P1000 (Call the program to machine the part)
N80 G55; (Switched the Datum 0,0 to the origin of the 2nd pallet)
N90 M98 P1000 (Call the program to machine the part)
.
.
.
And so on…

G54.1 CNC Code: Additional Work Offsets

The six work offsets available with G54-G59 present limitations if a machine has a large fixture plate with many workpieces. To accommodate this, CNC controllers have extended the syntax to allow for a larger number of offsets. The common syntax is “G54.1 Pnnn“, where “nnn” is a number ranging from 1 to 48 (and on some machines, up to 300).

  • The 54.1 offsets are in addition to the basic six offsets.
  • Some controllers may use a different syntax.

G-Code Example:

N10 G54.1 P28; (select work offset #28)

G52 CNC Code: Offsets to the offset

G52 specifies a temporary shift in the active coordinate system. It allows the machine to adjust the position to the subsequent G-codes relative to the active work offset. G52 is used after G54-G59 selects a work offset.

The syntax is: G52 Xxx Yyy Zzz

When the controller encounters G52, it will shift the datum of the active work offsets (G54-G59) by xx, yy, zz.
The new temporary datum will be active until the following G52 code or when a G54-G59 command changes the work offset.
The primary use case for G52 is a mechanical part with repeated identical geometrical features. In such a case, the CNC program can call a subroutine that machines the feature, and G52 is used to shift the datum.

Example: Repetitive features on the same part

Gcode Coordinate System G52

Many mechanical parts have repeated identical geometrical features. If there is a single blank on the pallet, you can use the G54-G59 technique described above. However, if you have multiple blanks on the pallet, a common way to handle additional datums within the workpiece is with G52.

* G52 sets a temporary coordinate system relative to the previously selected coordinate system.

CNC Program

G54 (Select datum for the 1st part)
G52 X50 Y20 (Shifts the datum to the location of the 1st feature on the part)
M98 P2000 (Machine the feature)
G52 X150 Y20 (Shifts the Datum to the next feature on the part)
M98 P2000 (Machine the feature)
.
.
.
And so on…

G92 CNC Code: Set a Temporary shift of the Work Coordinate Systems

The G92 CNC code shifts all coordinate systems (G54-G59 and G54.1) so that the given coordinates become the datum of the active work offset. All the non-active coordinate systems shift together with the active coordinate system, maintaining the relational positions between them.

For example, suppose that G55 is the active work offset, and a G92 X10 Y10 code is executed. The datum of G55 shifts by (10,10), and the (10,10) coordinate becomes (0,0). In addition, the datums of G54-G59 (and G54.1) coordinate systems also shift by (10,10), maintaining the original relationship between all the work offsets.

  • G92 is non-modal (active only for the block where it is placed).
  • G92 cancels an offset set by G52.
  • To cancel a G92 command, you need to enter another G92 code with the opposite value.

CNC Program Example


G00 G90 G55 X0 Y0 (Rapid to G54 origin)
G92 X10 Y10 (Shifts The origin of G54 by 10,10 - No movement)
G00 G90 G55 X0 Y0 (Rapid movement to the newly defined origin)
G92 X-10 Y-10 (Shifts the origin back to the original values - No movement)
G00 G90 G55 X0 Y0 (Rapid movement to the original G55 origin)

G53: Temporary Machine Datum

G53 temporarily cancels the active work offset (G54-G59) and uses the "machine coordinate system" as the datum.

  • The command is non-modal (active only for the block where it is placed)
  • The command ignores tool offsets.

The zero point for each axis is the position where the machine goes when a Zero Return (G28) is performed. It is usually the tool-change position.

Syntax: G53 G0 X0 Y0 Z0 (Sets the machines datum as the active coordinate system and moves to that position)


Learn about more G-Codes

Scroll to Top