G-code reference

G37 G-Code: Automatic Tool Length Measurement

Automatic Tool Length Measurement — On Fanuc mills, moves the tool toward a tool-length sensor until it triggers and updates the active H offset with the measured difference. On Fanuc lathes…

By cnccode · Updated
PropertyValue
CodeG37
FunctionAutomatic Tool Length Measurement
Modal group00
TypeOne-shot (non-modal) — active only in its own block
Used onMills and lathes
SyntaxG37 Z_ (mill) / G37 Z_ (lathe)

What does G37 do?

On Fanuc mills, moves the tool toward a tool-length sensor until it triggers and updates the active H offset with the measured difference. On Fanuc lathes (system A) it measures and sets the Z offset.

G37 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
G37 Z_ (mill)  /  G37 Z_ (lathe)
AddressMeaning
ZMeasuring position

G37 example program

Example
T5 M06
G43 H05 Z50.0
G37 Z-100.0

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Many shops use the probe manufacturer's macros instead (e.g. O9853).

Controller compatibility

G37 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 G37 modal?
No. G37 is a one-shot (group 00) code and only acts in the block where it appears.
What does G37 mean in CNC?
G37 means Automatic Tool Length Measurement. On Fanuc mills, moves the tool toward a tool-length sensor until it triggers and updates the active H offset with the measured difference. On Fanuc lathes (system A) it measures and sets the Z offset.
What is the difference between G37 and G36?
G37 is Automatic Tool Length Measurement, while G36 is Automatic Tool Compensation X (Lathe). See the G36 page for its syntax and examples.
Can I use G37 on a lathe?
Yes, G37 is used on both mills and lathes, although some parameters differ between them.