Free printable

G-code cheat sheet

Two printable sheets: 71 mill codes and 57 lathe codes, grouped by what they do (motion, offsets, compensation, cycles, spindle, coolant, program control), each with a one-line meaning. Press Print or save as PDF for a one-page copy without the website around it.

Mill G-code and M-code cheat sheet

Motion

G00
Rapid positioning
G01
Linear interpolation (feed move)
G02
Circular interpolation, clockwise
G03
Circular interpolation, counterclockwise

Plane

G17
XY plane selection
G18
XZ plane selection
G19
YZ plane selection

Units

G20
Inch units
G21
Metric units

Positioning mode

G90
Absolute positioning
G91
Incremental positioning

Work offset

G54
Work offset 1
G55
Work offset 2
G56
Work offset 3
G57
Work offset 4
G58
Work offset 5
G59
Work offset 6

Feed mode

G93
Inverse time feed
G94
Feed per minute
G95
Feed per revolution

Spindle speed mode

G97
Constant RPM

Cutter compensation

G40
Cutter compensation cancel
G41
Cutter compensation left
G42
Cutter compensation right

Tool length

G43
Tool length compensation +
G44
Tool length compensation −
G49
Tool length compensation cancel

Canned cycle

G73
High-speed peck drilling
G74
Left-hand tapping cycle
G76
Fine boring cycle
G80
Canned cycle cancel
G81
Drilling cycle (spot drill)
G82
Drilling cycle with dwell
G83
Deep hole peck drilling
G84
Tapping cycle (right hand)
G85
Boring cycle (feed out)
G86
Boring cycle (spindle stop, rapid out)
G89
Boring cycle with dwell (feed out)

Cycle return

G98
Canned cycle return to initial point
G99
Canned cycle return to R plane

Cutting mode

G61
Exact stop mode
G64
Cutting mode (continuous path)

Polar coordinates

G15
Polar coordinates off
G16
Polar coordinates on

Rotation

G68
Coordinate rotation
G69
Coordinate rotation cancel

Non-modal

G04
Dwell
G09
Exact stop (one block)
G10
Programmable data input
G28
Return to reference position
G30
Return to second reference position
G52
Local coordinate system
G53
Machine coordinate move
G65
Macro call
G92
Set coordinate system (shift)

Spindle

M03
Spindle on, clockwise
M04
Spindle on, counterclockwise
M05
Spindle stop
M19
Spindle orientation
M29
Rigid tapping mode (Fanuc)

Coolant

M07
Mist coolant on
M08
Flood coolant on
M09
Coolant off

Tool

M06
Tool change

Program control

M00
Program stop
M01
Optional stop
M02
End of program
M30
End of program and rewind
M97
Local subprogram call (Haas)
M98
Subprogram call
M99
Subprogram end / return

gcodepractice.com/g-code-cheat-sheet · Fanuc-style codes; check your machine's manual for options and builder codes.

Lathe G-code and M-code cheat sheet (Fanuc system A)

Motion

G00
Rapid positioning
G01
Linear interpolation (feed move)
G02
Circular interpolation, clockwise
G03
Circular interpolation, counterclockwise
G32
Thread cutting (single pass)

Plane

G18
XZ plane selection

Units

G20
Inch units
G21
Metric units

Work offset

G54
Work offset 1
G55
Work offset 2
G56
Work offset 3
G57
Work offset 4
G58
Work offset 5
G59
Work offset 6

Feed mode

G98
Feed per minute
G99
Feed per revolution

Spindle speed mode

G96
Constant surface speed
G97
Constant RPM

Cutter compensation

G40
Cutter compensation cancel
G41
Cutter compensation left
G42
Cutter compensation right

Lathe cycle

G70
Finishing cycle
G71
Rough turning cycle
G72
Rough facing cycle
G73
Pattern repeating cycle
G74
Face peck drilling / grooving
G75
Grooving cycle (X)
G76
Threading cycle (multi-pass)
G90
Outside/inside diameter cutting cycle
G92
Thread cutting cycle
G94
Facing cycle

Cutting mode

G61
Exact stop mode
G64
Cutting mode (continuous path)

Non-modal

G04
Dwell
G09
Exact stop (one block)
G10
Programmable data input
G28
Return to reference position
G30
Return to second reference position
G50
Maximum spindle speed
G52
Local coordinate system
G53
Machine coordinate move
G65
Macro call

Spindle

M03
Spindle on, clockwise
M04
Spindle on, counterclockwise
M05
Spindle stop
M19
Spindle orientation
M29
Rigid tapping mode (Fanuc)

Coolant

M07
Mist coolant on
M08
Flood coolant on
M09
Coolant off

Program control

M00
Program stop
M01
Optional stop
M02
End of program
M30
End of program and rewind
M97
Local subprogram call (Haas)
M98
Subprogram call
M99
Subprogram end / return

gcodepractice.com/g-code-cheat-sheet · Fanuc-style codes; check your machine's manual for options and builder codes.

Knowing the sheet by heart is faster than reading it at the machine. Drill the core codes in 60-second rounds until you no longer need it.

More practice hubs

Frequently asked questions

Is there a printable G-code cheat sheet?
Yes, this page. Press "Print or save as PDF" for the mill or lathe sheet; it prints on one or two A4 or Letter pages without the website around it. Choose "Save as PDF" in the print dialog for a PDF file.
Which G-codes should be on a cheat sheet?
The ones in every program: G00 to G03 motion, G17 to G19 planes, G20/G21 units, G28, G40 to G43 compensation, G54 to G59 work offsets, G80 to G83 drilling cycles, G90/G91, and M00, M01, M03 to M09 and M30. Lathe sheets add G50, G70 to G76 and G96/G97. This sheet has all of them grouped by what they do.
Are these codes the same on every machine?
The core codes are the same on Fanuc, Haas and most Fanuc-style controls. Some numbers mean different things on mills and lathes, which is why there are two sheets, and some controls add their own codes. Check your machine's manual for anything not on the sheet.

G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.

Free preview · no card Try G-Code Sprint