CNC programmers rely on G-code and M-code commands to control machine motion and machining operations. These commands define tool movements, spindle operations, coolant systems, and drilling cycles.
A well-structured CNC programming cheat sheet allows machinists and programmers to quickly reference the most important commands used in daily CNC machining.
This guide provides a practical reference for essential CNC commands used in modern CNC machines including Fanuc, Haas, Siemens, and other ISO G-code compatible controllers.
════════════════════════════════════════════════════════════
SECTION 1 — BASIC MOTION COMMANDS
════════════════════════════════════════════════════════════
G00 Rapid positioning
Moves the tool quickly without cutting.
Example
G00 X50 Y50
G01 Linear interpolation
Moves the tool in a straight line while cutting.
Example
G01 X40 Y20 F200
G02 Circular interpolation clockwise
Example
G02 X50 Y50 I20 J0
G03 Circular interpolation counterclockwise
Example
G03 X20 Y20 I-10 J0
════════════════════════════════════════════════════════════
SECTION 2 — MACHINE MODE COMMANDS
════════════════════════════════════════════════════════════
G90 Absolute programming
Coordinates referenced from part zero.
G91 Incremental programming
Coordinates referenced from current tool position.
Example
G91 X10 Y0
This moves the tool 10 mm relative to its current position.
════════════════════════════════════════════════════════════
SECTION 3 — PLANE SELECTION
════════════════════════════════════════════════════════════
G17 XY plane
Standard milling plane.
G18 ZX plane
Used in turning operations.
G19 YZ plane
Used in special machining conditions.
════════════════════════════════════════════════════════════
SECTION 4 — WORK OFFSET COMMANDS
════════════════════════════════════════════════════════════
Work offsets define part coordinate systems.
G54 Work offset 1
G55 Work offset 2
G56 Work offset 3
G57 Work offset 4
G58 Work offset 5
G59 Work offset 6
Example
G54
This activates the first work coordinate system.
════════════════════════════════════════════════════════════
SECTION 5 — TOOL COMPENSATION
════════════════════════════════════════════════════════════
G40 Cancel cutter compensation
G41 Cutter compensation left
G42 Cutter compensation right
Example
G41 D01
Tool length compensation
G43 Tool length offset
Example
G43 H01 Z100
════════════════════════════════════════════════════════════
SECTION 6 — DRILLING CANNED CYCLES
════════════════════════════════════════════════════════════
G81 Standard drilling
Example
G81 X20 Y20 Z-15 R2 F120
G82 Spot drilling
G83 Peck drilling
Example
G83 X40 Y40 Z-30 R3 Q5
G84 Tapping cycle
G80 Cancel cycle
════════════════════════════════════════════════════════════
SECTION 7 — SPINDLE CONTROL M-CODES
════════════════════════════════════════════════════════════
M03 Spindle clockwise
Example
M03 S3000
M04 Spindle counter-clockwise
M05 Spindle stop
════════════════════════════════════════════════════════════
SECTION 8 — TOOL AND PROGRAM CONTROL
════════════════════════════════════════════════════════════
M06 Tool change
Example
T1 M06
M00 Program stop
M01 Optional stop
M30 Program end and reset
════════════════════════════════════════════════════════════
SECTION 9 — COOLANT COMMANDS
════════════════════════════════════════════════════════════
M07 Mist coolant on
M08 Flood coolant on
M09 Coolant off
Example
M08
════════════════════════════════════════════════════════════
SECTION 10 — SAMPLE CNC PROGRAM
════════════════════════════════════════════════════════════
%
O1001
G90 G17 G40 G49 G80
G54
T1 M06
S3500 M03
G00 G43 Z100 H01
G00 X0 Y0
G01 Z-5 F200
G01 X50
G01 Y50
G01 X0
G01 Y0
G00 Z100
M30
════════════════════════════════════════════════════════════
FINAL PRINCIPLE
A CNC programming cheat sheet provides machinists and programmers with quick access to the most important commands used in daily machining operations. By mastering these essential G-code and M-code commands, CNC professionals can program machines more efficiently and safely across a wide range of manufacturing applications.
Leave a comment