# Useful FANUC G & M Codes

Published on 2026-08-23

FANUC G-Codes and M-Codes I use from time to time

Source: CNC Programming Notes (G-Code & M-Code Reference)
Summary: Operational guide for standard CNC machining commands and safety patterns:
1. M99: Restarts the current program from the beginning for continuous looping.
2. M19: Locks/orients the spindle chuck for maintenance or setup work.
3. M01: Pauses execution after tool changes when the optional stop switch is engaged.
4. G04: Introduces a timed delay (e.g., G04 X[seconds]) to bypass mechanical interlocks.
5. G28: Homes axes (U0. for X, W0. for Z) to clear space for safe turret rotation.