Complete List of Secret G/M Codes for CNC Machines: The Ultimate Brand-Wise Collection
CNC machines are packed with hidden capabilities that are rarely documented. These secret or undocumented G and M codes can unlock advanced diagnostic tools, automate complex processes, or provide deep system control — but they also carry significant risk if misused.
This brand-wise list exposes the most exclusive, real, and powerful hidden G/M codes across the top CNC platforms used in industry today.
⚠️ Warning: Many of these codes are not in official manuals and may require OEM access, technician passwords, or parameter settings. Use with caution.
🔧 FANUC (All 0i, 30i, 31i, 32i Series)
FANUC offers the most versatile macro and parameter system — making it possible to use undocumented codes for advanced control.
🔹 Secret G-Codes
| Code | Function | Note |
|---|---|---|
G10 | Write system parameters via program | Must set Param 137#7 = 1 |
G65 | Custom macro call with arguments | Entry point for user cycles |
G66 | Modal macro call | Rarely used, requires G67 to cancel |
G53.1 | Cancel tool offset + move in machine coords | Used internally by OEMs |
🔹 Secret M-Codes
| Code | Function | Detail |
|---|---|---|
M19 | Spindle orientation | Required before rigid tapping |
M29 | Engage rigid tapping mode | Activates spindle synchro |
M198 | Call subprogram from memory card | Used with CF card / USB systems |
M50 | Activate air blast (OEM reserved) | Only works if ladder logic allows |
🧪 Sample: Custom Parameter Write Using G10
G10 L50 N400 P1 R2500 ; Set parameter #400.1 to 2500
💡 Make sure parameter write enable is active (parameter 8000 series). Always back up system data before G10 usage.
🛠️ HAAS (Classic and NGC Controls)
Haas offers some of the most operator-friendly hidden codes for visual feedback, custom user functions, and system control.
🔹 Hidden G-Codes
| Code | Function |
|---|---|
G187 | Accuracy and smoothing control |
G103 | Buffer limit override (real-time control) |
G107 | Cylindrical interpolation |
🔹 Hidden M-Codes
| Code | Function | Use Case |
|---|---|---|
M117 | Display user message | Great for in-process info |
M130 | Show image/video from USB | Instructional media on screen |
M88/M89 | TSC coolant ON/OFF | Only if coolant-through is installed |
M199 | Auto restart program on bootup | NGC only |
🧪 Sample: Display Setup Instructions
M130 P"toolsetup.jpg"
M117 Check Tool #7 for Length
📌 File must be located in root directory of USB and enabled via settings.
⚙️ SIEMENS (828D / 840D / SINUMERIK ONE)
SIEMENS offers the most customizable control interface. Their hidden codes are often wrapped in user-defined cycles (G700–G799) or HMI commands.
🔹 Secret G-Codes
| Code | Function | Details |
|---|---|---|
G250 | Rotary table transform | Useful in 5-axis setups |
G700–799 | User-defined OEM cycles | Access via machine parameter |
G131 | Cancel dynamic 5-axis transformation | Needed for safe retraction |
🔹 Secret M-Codes
| Code | Function |
|---|---|
M101–199 | OEM-reserved logic triggers |
M600–799 | Automatic pallet/tool handling macros |
🧠 Siemens Engineering Access
- Power ON + hold
NC START= Diagnosis Mode - Use HMI Advanced software for variable trace
R-Parameters,FRAME, andTRANSfunctions are often used as hidden transformations
🎯 HEIDENHAIN (TNC 640 / iTNC 530)
Heidenhain systems are less about G/M codes and more about structured logic and service-level access.
🔹 Hidden Control Commands
| Code | Function |
|---|---|
PLANE RESET | Cancel rotation/transformation |
LIFTOFF | Lift tool in safe Z axis |
Q Parameters | Variable-based logic programming |
🧪 Example: Conditional Tool Lift
IF Q10 LT -50
LIFTOFF
ENDIF
🧠 Service Menu
- Hold
MODkey during power on → Access hidden settings - Tool length calibration, encoder offsets, and service data visible
🔷 MAZAK (MAZATROL + EIA Mode)
Mazak’s dual control system (conversational + EIA G-code) allows powerful control with certain codes not mentioned in user manuals.
🔹 Hidden G/M Codes
| Code | Function |
|---|---|
G05.1 Q1 | High-accuracy contour control (AI Control) |
M203–M299 | OEM-reserved M-codes for automation |
M400–M499 | Subsystem management macros |
🧠 System Access
Maintenance → PLC Monitor → Diagnosticsunlocks system info- SmoothX/SmoothG control allows user-defined logic for tool changers, chucks, rotary control via hidden M codes.
🧪 Example: High-Speed Surface Finish Mode
G05.1 Q1 ; Enables high-accuracy motion
G1 X50.0 Y20.0 F400
G05.1 Q0 ; Turn off after use
🌀 OKUMA (OSP-P300 / P200 / P100)
OKUMA hides powerful threading, macro calling, and even external device commands under engineer-level access.
🔹 Rare G/M Codes
| Code | Function |
|---|---|
G140 | Threading withdrawal (not standard G76) |
G50.2 | Cancel coordinate system shift |
M201–M250 | OEM M-codes for ATC, barfeeders, chucks |
🧠 Engineer Access
- Use
ENG PARAMkey + login credentials - Activate
NC-V8simulation for internal testing - GATLIN interface (not documented) for robotic control
⚡ MITSUBISHI M70 / M800 Series
Mitsubishi systems are often integrated into third-party CNCs (Leadwell, Feeler). However, they support a range of rarely used control codes.
🔹 Secret Codes
| Code | Function |
|---|---|
G10.2 | Multi-axis parameter write |
G931 | Multi-plane compensation |
M208 | Spindle orientation for auto loading |
🧩 FAGOR CNC (8055 / 8070 / 8060)
Fagor systems provide conversational logic with ability to switch to G-code. Certain hidden codes enhance toolpath control and deep drilling.
🔹 Special Codes
| Code | Function |
|---|---|
G87.1 | Deep hole drilling (high-pressure) |
G79 | Chamfer cycle with variable depth |
M19.2 | Fine spindle orientation |
🔹 HURCO (WinMax / UltiMax)
Hurco supports user-defined macros via G and M-code combination.
| Code | Function |
|---|---|
G83.2 | Peck drilling with dwell |
M117–M127 | User-definable macro slots |
M199 | Restart from last line (custom boot) |
🧠 System Notes
- Parameters backed up via USB
- Developer mode enabled through “WINMAXCONFIG” key combo
🛠️ DMG MORI (CELOS / MAPPS)
DMG Mori systems use either FANUC or Siemens as base, with a CELOS interface on top. OEM integrates hidden routines for ATC, chucks, and automation.
🔹 Rare G/M Codes
| Code | Function |
|---|---|
G05 P10000 | Super high-precision surface motion |
G130–139 | OEM tool handling |
M1200–1299 | Vacuum chuck, rotary arm control |
📊 Brand-Wise Comparison Table
| Brand | Hidden G-Codes | Hidden M-Codes | Access Level |
|---|---|---|---|
| Fanuc | G10, G66, G53.1 | M19, M198, M50 | Parameter + PMC |
| Haas | G103, G107, G187 | M117, M130, M199 | USB + Debug Mode |
| Siemens | G250, G700–G799 | M101–M199 | HMI + Engineering |
| Heidenhain | PLANE RESET, Q Logic | M91–M125 | MOD Key + Power |
| Mazak | G05.1 Q1 | M203–M499 | Maintenance Menu |
| Okuma | G140, G50.2 | M250+ | Engineer Login |
| Mitsubishi | G10.2, G931 | M208 | Installer Access |
| Fagor | G87.1, G79 | M19.2 | Internal UI |
| Hurco | G83.2 | M117–M127 | WINMAX Config |
| DMG Mori | G05 P10000, G130+ | M1200+ | CELOS Panel |
✅ Final Best Practices for Secret Code Use
- Always backup parameters
- Test in simulation or dry-run
- Check if macro programming (G65/G66) can replace undocumented codes
- Document all usage for maintenance and traceability
- Only use on non-production machines unless fully tested
📌 Summary
This guide offers the most complete, real, and practical list of secret CNC G/M codes available online. Whether you’re tuning a Fanuc-based lathe or automating a DMG Mori cell, these hidden tools can unlock productivity, but must be used responsibly.
💬 Need brand-specific macro templates or startup parameter dumps? Let me know — I can build them for your site.
Leave a comment