Complete G-Code & M-Code List for All Major CNC Brands (Fanuc, Haas, Siemens, Heidenhain, Mazak)
This is the ultimate reference guide to G-codes and M-codes across the most popular CNC controls.
Whether you are programming Fanuc, Haas, Siemens, Heidenhain, or Mazak, this guide helps you quickly find the right code — including some lesser-known and hidden codes for advanced users.
📌 1. Fanuc G-Codes (ISO Standard + Fanuc-Specific)
| G-Code | Function |
|---|---|
| G00 | Rapid positioning |
| G01 | Linear interpolation |
| G02 / G03 | Circular interpolation (CW / CCW) |
| G10 | Programmable offsets |
| G12 / G13 | Circular pocket milling |
| G41 / G42 | Cutter compensation (L/R) |
| G65 | Custom macro simple call |
| G68 | Coordinate rotation |
| G76 | Fine boring cycle |
| G83 | Peck drilling cycle |
| G84 | Tapping cycle |
| G96 | CSS (Constant Surface Speed) |
| G99 | Return to initial plane |
📌 2. Fanuc M-Codes (Common)
| M-Code | Function |
|---|---|
| M00 | Program stop |
| M03 / M04 | Spindle CW/CCW |
| M05 | Spindle stop |
| M06 | Tool change |
| M08 / M09 | Coolant on/off |
| M30 | Program end & reset |
| M98 / M99 | Subprogram call / return |
📌 3. Haas CNC G-Codes (Additional)
| G-Code | Function |
|---|---|
| G187 | Motion smoothing |
| G150 | Pocket milling |
| G47 | Engraving cycle |
| G110–G129 | Additional work offsets |
Haas also supports VPS Macros for easy probing and tool setup.
📌 4. Siemens Sinumerik G-Codes (Cycle-Based)
| Cycle | Function |
|---|---|
| CYCLE82 | Drilling |
| CYCLE83 | Peck drilling |
| CYCLE97 | Thread cutting |
| CYCLE800 | Swivel cycle (5-axis) |
| CYCLE977 | Workpiece measurement |
📌 5. Heidenhain Codes
Heidenhain uses plain language programming but still supports G-codes in ISO mode.
| Code | Function |
|---|---|
| CYCL DEF 200 | Drilling |
| CYCL DEF 205 | Peck drilling |
| CYCL DEF 207 | Tapping |
| CYCL DEF 400 | Datum setting (probing) |
📌 6. Mazak Smooth Control (EIA / Mazatrol)
Mazak supports both EIA G-code and Mazatrol conversational programming.
- G61.1 → High-precision contouring
- G68 → Coordinate rotation
- G65 P98xx → Probing macros
- M198 → Call subprogram from memory card
📌 7. Hidden & Advanced Codes (For Experts)
| Control | Hidden Code | Function |
|---|---|---|
| Fanuc | G05.1 Q1 | AI contour control (high-speed machining) |
| Fanuc | G12.1 | Polar coordinate interpolation |
| Haas | M59/M69 | Custom I/O control |
| Siemens | TRAORI | Tool center point control (5-axis) |
| Heidenhain | M128 | TCPM (Tool Center Point Management) |
📌 8. Best Practices for Multi-Brand Programming
- Always verify G-code compatibility before running on a different machine.
- Use post-processors in CAM software tuned for each control.
- Leverage custom macros to reduce repetitive code.
✅ Conclusion
This guide covers the most-used G-codes and M-codes for Fanuc, Haas, Siemens, Heidenhain, and Mazak — plus some hidden gems for advanced programming.
Bookmark this page as your go-to reference whenever you program a new part or switch between machine brands.
Leave a comment