- HomePage /
- Sector News /
- CNC /
- G AND M CODES FOR CNC MACHINING CENTERS
G AND M CODES FOR CNC MACHINING CENTERS
G AND M CODES FOR CNC MACHINING CENTERS
G Codes (Gnn)
G codes are used in CNC machining center programming to define tool movements and machining operations. The most commonly used G codes are listed below:
Common G Codes:
G00 – Rapid positioning (Fast movement without cutting) G01 – Linear interpolation (Cutting movement along a straight path) G02 – Circular interpolation (Clockwise - CW) G03 – Circular interpolation (Counter-clockwise - CCW) G04 – Dwell (Pause before proceeding)
Coordinate Systems & Plane Selection:
G15 – Cancel angular coordinate system G16 – Activate angular coordinate system G17 – Select XY plane G18 – Select ZX plane G19 – Select YZ plane
Unit System Selection:
G20 – Inch unit system G21 – Metric unit system
Machine Home & Reference:
G28 – Return to machine home position
Tool Compensation & Offsets:
G40 – Cancel tool radius compensation G41 – Tool radius compensation (Left) G42 – Tool radius compensation (Right) G43 – Tool length compensation (+ direction) G44 – Tool length compensation (- direction) G49 – Cancel tool length compensation
Workpiece Offsets & Referencing:
G50 – Cancel scaling mode G54 - G59 – Select different workpiece coordinate systems
Drilling & Tapping Cycles:
G73 – High-speed peck drilling cycle G74 – Left-hand tapping cycle G76 – Precision boring cycle G80 – Cancel drilling cycles G81 – Basic drilling cycle G82 – Drilling cycle with dwell at the bottom G83 – Deep hole drilling cycle (Peck drilling) G84 – Tapping cycle
Turning & Thread Cutting Cycles:
G90 – External/internal turning cycle (Single pass) G92 – Thread cutting cycle G94 – Facing cycle (Parallel to X-axis)
Speed Control Modes:
G96 – Constant surface cutting speed G97 – Constant spindle speed
Feedrate Modes:
G98 – Feedrate in mm/min (inches/min) G99 – Feedrate in mm/rev (inches/rev)
M Codes (Mnn)
M codes are miscellaneous functions that control auxiliary machine operations.
Common M Codes:
M00 – Program stop M01 – Optional program stop M02 – End of program (For single-part production) M03 – Spindle rotation CW (Clockwise) M04 – Spindle rotation CCW (Counter-clockwise) M05 – Stop spindle rotation ? M06 – Tool change M08 – Coolant ON M09 – Coolant OFF M30 – Program end and return to start M98 – Call a subprogram M99 – End of subprogram
Important Notes:
Leading zeros in G and M codes (e.g., G01 vs. G1) are optional and do not affect program execution. G and M codes must be used in correct order for proper execution of CNC machining processes. M00 & M01 difference: M00 stops the machine always, while M01 only works when optional stop is enabled.