Introduction
This article provides an in-depth exploration of the M-Code plain text language.
You will learn about the following topics:
- The meaning of G-Codes
- Fanuc G-Code List (Lathe)
- Fanuc G-Code List (Mill)
- The role of subprograms and macros in CNC programming
- A brief overview of CNC machining

G-Codes and Their Meaning
G-code is a plain text language used to control CNC machines. While modern CNC machines typically don't require users to understand G-codes directly (as CAD/CAM software converts designs into G or M codes), curious operators may still examine these commands. Although G-code isn't easily readable for most people, it's possible to review programmed machine instructions.
Despite being a standard CNC language, G-code implementations vary between manufacturers. Different controllers process information from AutoCAD or CAM software differently, depending on their programming.

CNC programs combine G-codes with other lettered instructions to control machine operations. While G-codes specify functions for lathes or mills, M-codes manage machine operations using additional parameters like feed rate (F) and spindle speed (S).
Although generally straightforward, CNC programming follows specific conventions. Programs begin and end with percent symbols, and use naming formats from O0001 to O9999. G-codes remain active until canceled or replaced by another command. Tool movement occurs through interpolation, which coordinates changes along X and Y axes simultaneously, using either linear or circular interpolation methods.