G-Code and M-Code List [ Easy To Use Examples &
Tutorials ]
Milling G Code List
Turning G Code List
GCode Simulator
Fanuc Alarm Code List
Complete CNC g code list with m-codes for milling in the Fanuc,
LinuxCNC, GRBL, and Haas CNC machines dialects. We give a quick
definition for all g codes along with a link to tutorials and examples of
how to use it in CNC programming. Click the g-code link (if any) to visit a
tutorial from our popuplar Online Free G-Code Training that shows
examples and teaches how to program CNC machines using the g-code
commands. This page is your ideal g-code reference.
G Codes and CNC
G-Code List
Code Category Function Notes
g00 rapid:
Move in a XYZ of
G00 Motion
straight line at endpoint
rapids speed.
G01 Motion Move in a XYZ of
straight line at endpoint
last speed
commanded by
a (F)eedrate
Circular XYZ of
Interpolation: endpoint IJK
G02 Motion Clockwise relative to
circular arc at center R for
(F)eedrate radius
Circular
XYZ of
Interpolation:
endpoint IJK
Counter-
G03 Motion relative to
clockwise
center R for
circular arc at
radius
(F)eedrate
P for
Dwell: Stop for
milliseconds
G04 Motion a specified
X for
time.
seconds
FADAL Non-
G05 Motion
Modal Rapids
Exact stop
G09 Motion
check
Programmable
G10 Compensation parameter
input
Turn Polar
Coordinates
G15 Coordinate OFF, return to
Cartesian
Coordinates
Turn Polar
G16 Coordinate Coordinates
ON
Select X-Y
G17 Coordinate plane (Plane
Selection)
Select X-Z
G18 Coordinate plane (Plane
Selection)
Select Y-Z
G19 Coordinate plane (Plane
Selection)
Program
G20 Coordinate coordinates are
inches
Program
G21 Coordinate coordinates are
mm
Reference
G27 Motion point return
check
Return to home
G28 Motion
position
Return from
G29 Motion the reference
position
Return to the
2nd, 3rd, and
G30 Motion
4th reference
point
Constant lead
threading (like
G32 Canned G01
synchronized
with spindle)
Tool cutter
compensation
G40 Compensation
off (radius
comp.)
Tool cutter
compensation
G41 Compensation
left (radius
comp.)
Tool cutter
compensation
G42 Compensation
right (radius
comp.)
Apply tool
length
G43 Compensation
compensation
(plus)
Apply tool
length
G44 Compensation
compensation
(minus)
Tool length
G49 Compensation compensation
cancel
Reset all scale
G50 Compensation
factors to 1.0
Turn on scale
G51 Compensation
factors
Local workshift
for all
G52 Coordinate coordinate
systems: add
XYZ offsets
Machine
coordinate
G53 Coordinate
system (cancel
work offsets)
G54 Coordinate Work
coordinate
system (1st
Workpiece)
Work
coordinate
G55 Coordinate
system (2nd
Workpiece)
Work
coordinate
G56 Coordinate
system (3rd
Workpiece)
Work
coordinate
G57 Coordinate
system (4th
Workpiece)
Work
coordinate
G58 Coordinate
system (5th
Workpiece)
Work
coordinate
G59 Coordinate
system (6th
Workpiece)
Exact stop
G61 Other
check mode
Automatic
G62 Other
corner override
G63 Other Tapping mode
Best speed
G64 Other
path
Custom macro
G65 Other
simple call
Coordinate
G68 Coordinate System
Rotation
Cancel
Coordinate
G69 Coordinate
System
Rotation
High speed
G73 Canned drilling cycle
(small retract)
Left hand
G74 Canned
tapping cycle
Fine boring
G76 Canned
cyle
Cancel canned
G80 Canned
cycle
Simple drilling
G81 Canned
cycle
G82 Canned Drilling cycle
with dwell
(counterboring)
Peck drilling
G83 Canned cycle (full
retract)
G84 Canned Tapping cycle
Boring cycle,
G85 Canned no dwell, feed
out
Boring cycle,
G86 Canned spindle stop,
rapid out
Back boring
G87 Canned
canned cycle
Boring canned
cycle, spindle
G88 Canned
stop, manual
out
Boring canned
G89 Canned cycle, dwell,
feed out
Absolute
programming
G90 Coordinate
of XYZ (type B
and C systems)
Absolute
programming
G90.1 Coordinate
IJK (type B and
C systems)
Incremental
programming
G91 Coordinate
of XYZ (type B
and C systems)
Incremental
programming
G91.1 Coordinate
IJK (type B and
C systems)
Offset
coordinate
G92 Coordinate system and
save
parameters
Clamp of
G92
Motion maximum S
(alternate)
spindle speed
Cancel offset
G92.1 Coordinate and zero
parameters
Cancel offset
G92.2 Coordinate and retain
parameters
Offset
coordinate
G92.3 Coordinate system with
saved
parameters
Inverse Time
Feed Mode.
G93 Motion
For use with
rotary axes
Units per
minute feed
G94 Motion
mode. Units in
inches or mm.
Units per
revolution feed
G95 Motion
mode. Units in
inches or mm.
Constant
G96 Motion
surface speed
Cancel
G97 Motion constant
surface speed
Return to initial
G98 Canned Z plane after
canned cycle
Return to initial
G99 Canned R plane after
canned cycle
M Code List to
Control Machine
Functions
M
Category Function Notes
Codes
m00 Program Stop
M00 M-Code
(non-optional)
Optional Stop:
M01 M-Code Operator Selected to
Enable
M02 M-Code End of Program
m03 Spindle ON
M03 M-Code
clockwise
Spindle ON (CCW
M04 M-Code
Rotation)
M05 M-Code m05 Spindle Stop
M06 M-Code Tool Change
M07 M-Code Mist Coolant ON
M08 M-Code Flood Coolant ON
M09 M-Code Coolant OFF
FADAL subroutine
M17 M-Code
return
Rigid Tapping Mode
M29 M-Code
on Fanuc Controls
End of Program,
M30 M-Code Rewind and Reset
Modes
Haas-Style
M97 M-Code
Subprogram Call
M98 M-Code Subprogram Call
Return from
M99 M-Code
Subprogram
F M-Code Set Feedrate
S M-Code Set Spindle Speed
Select Tool for Tool
T M-Code
Change
Sets coordinates for
X, Y,
the axes: x axis, y
Z, and M-Code
axis, z axis and a
A
axis.