G-code is the universal language of CNC machining. Despite decades of usage, many operators and programmers still struggle to understand modal behavior, hidden risks, and advanced functions that professional shops rely on daily.
This encyclopedia explains the most important G-codes used in modern machining environments, real production examples, and common mistakes that cause crashes.
────────────────────────────────────────
G00 — Rapid Positioning (Most Dangerous Move)
────────────────────────────────────────
Purpose:
Move machine at maximum speed.
Real Risk:
Diagonal motion can collide with fixtures.
Professional method:
Retract Z first.
Example:
G00 Z100.
G00 X150 Y80
Never rapid toward unknown geometry.
────────────────────────────────────────
G01 — Linear Feed Motion
────────────────────────────────────────
Controlled cutting movement.
Common mistake:
Missing feedrate after restart.
Always confirm F value active.
────────────────────────────────────────
G02 / G03 — Circular Interpolation
────────────────────────────────────────
Clockwise and counterclockwise arcs.
Hidden issue:
Wrong IJK center values cause alarms.
Example:
G02 X50 Y0 I25 J0 F500
Used heavily in bore finishing.
────────────────────────────────────────
G17 G18 G19 — Plane Selection
────────────────────────────────────────
Plane determines arc direction.
Wrong plane causes unpredictable motion.
Always reset plane at program start.
────────────────────────────────────────
G28 — Reference Return
────────────────────────────────────────
Unsafe usage:
G28 Z0
May move downward first.
Professional usage:
G91 G28 Z0
Forces safe retract.
────────────────────────────────────────
G41 / G42 — Cutter Compensation
────────────────────────────────────────
Adjust toolpath without reposting CAM.
Danger:
Tool jumps sideways if no lead-in.
Use linear entry.
────────────────────────────────────────
G43 — Tool Length Compensation
────────────────────────────────────────
Most common crash source.
Without G43:
Tool reference incorrect.
Safe example:
G43 H12 Z100.
────────────────────────────────────────
G54–G59 — Work Offsets
────────────────────────────────────────
Define part location.
Wrong offset scraps production silently.
Always force offset call.
────────────────────────────────────────
G80 — Cancel Canned Cycle
────────────────────────────────────────
Forgotten drilling cycle continues unexpectedly.
Always cancel.
────────────────────────────────────────
G81 / G83 — Drilling Cycles
────────────────────────────────────────
Simplify drilling operations.
Restart danger if cycle remains active.
────────────────────────────────────────
G90 / G91 — Positioning Modes
────────────────────────────────────────
G90 absolute.
G91 incremental.
Hidden crash source when inherited.
Always force G90.
────────────────────────────────────────
G94 / G95 — Feedrate Modes
────────────────────────────────────────
Feed per minute vs feed per revolution.
Wrong mode breaks tools instantly.
────────────────────────────────────────
Professional Safe Start Block
────────────────────────────────────────
Typical aerospace structure:
G90 G17 G40 G49 G80
G54
T10 M06
G43 H10 Z100.
State rebuilt before motion.
────────────────────────────────────────
Why This Encyclopedia Matters
────────────────────────────────────────
Operators search individual codes daily.
One encyclopedia page becomes:
- Reference bookmark.
- Training material.
- Forum link target.
Evergreen traffic source.
────────────────────────────────────────
Final Takeaway
────────────────────────────────────────
Mastering G-code is not memorization.
It is understanding modal logic, machine state, and motion behavior.
Professional machining combines knowledge with discipline.
Leave a comment