What are Fanuc G Codes & M Codes for CNC Programming
Home > Blog > What are Fanuc G Codes & M Codes for CNC Programming
Published by @WCY
2025.8.26
In modern CNC machining, G-codes and M-codes form the backbone of programming instructions that control how a machine operates. Whether you’re using a milling machine, turning center, or multitasking CNC, mastering these codes is essential for precision manufacturing. Among various CNC control systems, Fanuc is one of the most widely used in industries worldwide. This article provides an in-depth look at Fanuc G codes, their applications, and where you can find a complete G code list, Fanuc M code list, and Fanuc lathe M codes for efficient programming.
What Are Fanuc G Codes?
G-codes (preparatory functions) tell the CNC machine what kind of motion or operation to perform. In Fanuc-controlled machines, these codes specify positioning, interpolation, canned cycles, and more. Each G-code is typically a single letter followed by a numerical value, like G01 for linear interpolation or G02 for clockwise circular interpolation.
For example:
G00 – Rapid positioning
G01 – Linear cutting feed
G02 – Clockwise circular interpolation
G03 – Counterclockwise circular interpolation
A full G code list for Fanuc machines contains dozens of commands covering everything from coordinate systems to threading cycles.
Key Fanuc G Codes for CNC Machining
G00 – Rapid Traverse: Moves the machine axis at maximum speed to a specified coordinate.
G01 – Linear Interpolation: Cuts in a straight line at a programmed feed rate.
G02/G03 – Circular Interpolation: Executes circular cutting paths, essential for milling and turning arcs.
G20/G21 – Unit Selection: Sets the programming units to inches (G20) or millimeters (G21).
G54–G59 – Work Offsets: Selects different coordinate systems for multi-part setups.
G96/G97 – Spindle Speed Control: Constant surface speed (G96) or fixed spindle speed (G97), vital for lathe operations.
These codes ensure that the CNC machine follows precise toolpaths, resulting in consistent, high-quality parts.
What Are Fanuc M Codes?
While G-codes control motion, M-codes (miscellaneous functions) control auxiliary machine functions such as spindle start/stop, coolant, and tool changes.
Common Fanuc M codes include:
M03 – Spindle ON clockwise
M04 – Spindle ON counterclockwise
M05 – Spindle STOP
M08 – Coolant ON
M09 – Coolant OFF
M06 – Tool change (milling machines)
For turning operations, Fanuc lathe M codes include chuck clamp/unclamp, tailstock control, and live tooling activation. A complete CNC M code list Fanuc helps programmers quickly reference and implement these commands efficiently.
Fanuc Lathe M Codes: Essential Commands
Lathes often require additional functions beyond basic milling operations. Common Fanuc lathe M codes include:
M10/M11 – Chuck clamp/unclamp
M21/M22 – Tailstock advance/retract
M29 – Rigid tapping cycle synchronization
M31 – Spindle orientation for live tooling
These M-codes ensure proper workholding, threading, and auxiliary operations specific to turning centers.
Why Use a G Code List and Fanuc M Code List?
Having an organized G code list and Fanuc M code list at hand improves programming efficiency, reduces errors, and speeds up troubleshooting. Whether you’re writing programs manually or editing CAM-generated code, a reliable reference saves time and ensures compatibility with your CNC machine.
Many CNC professionals download PDF versions of Fanuc G-code lists and CNC M code lists Fanuc for quick offline access.
What Are the Basic G-Codes?
G00 – Rapid Positioning Moves the tool to a specified coordinate at the machine’s maximum speed (non-cutting move).
G01 – Linear Interpolation Moves the tool in a straight line at a programmed feed rate (cutting move).
G02 – Circular Interpolation (Clockwise) Moves the tool in a clockwise arc to a programmed end point.
G03 – Circular Interpolation (Counterclockwise) Moves the tool in a counterclockwise arc to a programmed end point.
G94 / G95 – Feed Rate Modes G94: Feed per minute (milling default) G95: Feed per revolution (lathe default)
Best Place to Find List of Fanuc G-Code Commands?
Fanuc Operator’s Manual (Official Source) Every Fanuc-controlled CNC machine comes with an official Fanuc Operator’s Manual, which contains the full G-code list and M-code list specific to your machine model. Best option for accuracy, as different Fanuc versions may support slightly different codes.
Machine Tool Builder’s Manual (OEM Manuals) Haas, Okuma, Mazak, and other manufacturers using Fanuc controls often include a dedicated Fanuc G-code reference section in their manuals. These manuals sometimes add custom G/M codes unique to the machine.
Fanuc’s Official Website & PDF Downloads Fanuc provides downloadable Fanuc CNC programming manuals (PDFs) that include Fanuc G-code commands. Search for: “Fanuc G-code list PDF site:fanucamerica.com” for North America or your local Fanuc site.
CNC Training Websites & Forums cnccookbook.com, practicalmachinist.com, and cnccoding.com offer well-organized Fanuc G-code lists with explanations and examples. Useful for learning, but always verify against your machine’s manual.
Quick-Reference G-Code PDFs Many CNC shops use printable Fanuc G/M code cheat sheets, often found online for free. Example search: “Fanuc G-code cheat sheet PDF”.
Copyright 2024 CNCJY Project By KALI, All Rights Reserved.