G-code reference

G52 G-Code: Local Coordinate System

Local Coordinate System — Shifts the zero point temporarily inside the active work offset. It is ideal for repeating features at several positions on one fixture.

By cnccode · Updated
PropertyValue
CodeG52
FunctionLocal Coordinate System
Modal group00
TypeOne-shot (non-modal) — active only in its own block
Used onMills and lathes
SyntaxG52 X_ Y_ Z_ / G52 X0 Y0 Z0 (cancel)

What does G52 do?

Shifts the zero point temporarily inside the active work offset. It is ideal for repeating features at several positions on one fixture.

G52 is a one-shot code: it only acts in the block where it is written, and the previously active modal codes take over again afterwards.

Syntax and parameters

Format
G52 X_ Y_ Z_  /  G52 X0 Y0 Z0 (cancel)
AddressMeaning
X Y ZShift from the current work offset zero

G52 example program

Example
G54
G52 X100.0 Y0 (second part)
M98 P1000
G52 X0 Y0 (cancel shift)

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Always cancel with G52 X0 Y0 Z0; a reset may not clear it on every control.
  • Works inside every work offset (G54–G59).

Controller compatibility

G52 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.

Frequently asked questions

Is G52 modal?
No. G52 is a one-shot (group 00) code and only acts in the block where it appears.
What does G52 mean in CNC?
G52 means Local Coordinate System. Shifts the zero point temporarily inside the active work offset. It is ideal for repeating features at several positions on one fixture.
What is the difference between G52 and G54?
G52 is Local Coordinate System, while G54 is Work Coordinate System 1. See the G54 page for its syntax and examples.
Can I use G52 on a lathe?
Yes, G52 is used on both mills and lathes, although some parameters differ between them.