G-code reference

G27 G-Code: Reference Position Return Check

Reference Position Return Check — Moves to the commanded position at rapid and checks that it is the reference (home) position; the reference lamp lights if correct, otherwise an alarm is…

By cnccode · Updated
PropertyValue
CodeG27
FunctionReference Position Return Check
Modal group00
TypeOne-shot (non-modal) — active only in its own block
Used onMills and lathes
SyntaxG27 X_ Y_ Z_

What does G27 do?

Moves to the commanded position at rapid and checks that it is the reference (home) position; the reference lamp lights if correct, otherwise an alarm is raised. It is used to verify that a program finishes at home.

G27 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
G27 X_ Y_ Z_
AddressMeaning
X Y ZMachine reference position (usually 0)

G27 example program

Example
G91 G27 Z0

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Cancel tool length and cutter compensation first.

Controller compatibility

G27 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 G27 modal?
No. G27 is a one-shot (group 00) code and only acts in the block where it appears.
What does G27 mean in CNC?
G27 means Reference Position Return Check. Moves to the commanded position at rapid and checks that it is the reference (home) position; the reference lamp lights if correct, otherwise an alarm is raised. It is used to verify that a program finishes at home.
What is the difference between G27 and G28?
G27 is Reference Position Return Check, while G28 is Return to Reference Point (Machine Home). See the G28 page for its syntax and examples.
Can I use G27 on a lathe?
Yes, G27 is used on both mills and lathes, although some parameters differ between them.