We strictly implement ISO quality standards and have received ISO 90001: 2015 certification.

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.

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:

A full G code list for Fanuc machines contains dozens of commands covering everything from coordinate systems to threading cycles.

  1. G00 – Rapid Traverse: Moves the machine axis at maximum speed to a specified coordinate.
  2. G01 – Linear Interpolation: Cuts in a straight line at a programmed feed rate.
  3. G02/G03 – Circular Interpolation: Executes circular cutting paths, essential for milling and turning arcs.
  4. G20/G21 – Unit Selection: Sets the programming units to inches (G20) or millimeters (G21).
  5. G54–G59 – Work Offsets: Selects different coordinate systems for multi-part setups.
  6. 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.

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:

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.

Lathes often require additional functions beyond basic milling operations. Common Fanuc lathe M codes include:

These M-codes ensure proper workholding, threading, and auxiliary operations specific to turning centers.

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.

  1. G00 – Rapid Positioning
    Moves the tool to a specified coordinate at the machine’s maximum speed (non-cutting move).
  2. G01 – Linear Interpolation
    Moves the tool in a straight line at a programmed feed rate (cutting move).
  3. G02 – Circular Interpolation (Clockwise)
    Moves the tool in a clockwise arc to a programmed end point.
  4. G03 – Circular Interpolation (Counterclockwise)
    Moves the tool in a counterclockwise arc to a programmed end point.
  5. G17/G18/G19 – Plane Selection
    G17: XY plane (milling default)
    G18: ZX plane (lathe default)
    G19: YZ plane
  6. G20 / G21 – Units Selection
    G20: Inches
    G21: Millimeters
  7. G28 – Return to Machine Home
    Sends the machine axes to a predefined home (reference) position.
  8. G40/G41/G42 – Cutter Compensation
    G40: Cancel cutter compensation
    G41: Cutter compensation left
    G42: Cutter compensation right
  9. G43 / G49 – Tool Length Compensation
    G43: Apply tool length offset
    G49: Cancel tool length offset
  10. G54 – G59 – Work Coordinate Systems
    Selects different work offsets for multiple setups.
  11. G90 / G91 – Positioning Modes
    G90: Absolute positioning
    G91: Incremental positioning
  12. G94 / G95 – Feed Rate Modes
    G94: Feed per minute (milling default)
    G95: Feed per revolution (lathe default)
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.