G-code reference

G30 G-Code: Return to 2nd/3rd/4th Reference Point

Return to 2nd/3rd/4th Reference Point — Like G28 but goes to a secondary reference position set by parameter, often used as a tool-change position on lathes or a part-loading position.

By cnccode · Updated
PropertyValue
CodeG30
FunctionReturn to 2nd/3rd/4th Reference Point
Modal group00
TypeOne-shot (non-modal) — active only in its own block
Used onMills and lathes
SyntaxG30 P2 U0 W0

What does G30 do?

Like G28 but goes to a secondary reference position set by parameter, often used as a tool-change position on lathes or a part-loading position.

G30 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
G30 P2 U0 W0
AddressMeaning
P2–P4Which reference point (P2 if omitted)

G30 example program

Example
G30 U0 W0 (lathe: go to tool change position)

▶ Open this example in the G-code viewer

Tips and common mistakes

  • The position is a machine parameter — check where it is before running.

Controller compatibility

G30 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 G30 modal?
No. G30 is a one-shot (group 00) code and only acts in the block where it appears.
What does G30 mean in CNC?
G30 means Return to 2nd/3rd/4th Reference Point. Like G28 but goes to a secondary reference position set by parameter, often used as a tool-change position on lathes or a part-loading position.
What is the difference between G30 and G28?
G30 is Return to 2nd/3rd/4th Reference Point, while G28 is Return to Reference Point (Machine Home). See the G28 page for its syntax and examples.
Can I use G30 on a lathe?
Yes, G30 is used on both mills and lathes, although some parameters differ between them.