G-Code and M-Code List (Easy Examples & Tutorials)
G-Code and M-Code List (Easy Examples & Tutorials)
Tutorials ]
Complete CNC g code list with m-codes for milling in the Fanuc,
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
g00 rapid:
Move in a XYZ of
G00 Motion
straight line at endpoint
rapids speed.
last speed
commanded by
a (F)eedrate
Circular XYZ of
(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
input
Turn Polar
Coordinates
Cartesian
Coordinates
Turn Polar
ON
Select X-Y
Selection)
Select X-Z
Selection)
Select Y-Z
Selection)
Program
inches
Program
mm
Reference
check
Return to home
G28 Motion
position
Return from
position
Return to the
point
Constant lead
threading (like
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
cancel
Turn on scale
G51 Compensation
factors
Local workshift
for all
systems: add
XYZ offsets
Machine
coordinate
G53 Coordinate
system (cancel
work offsets)
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
Rotation
Cancel
Coordinate
G69 Coordinate
System
Rotation
High speed
(small retract)
Left hand
G74 Canned
tapping cycle
Fine boring
G76 Canned
cyle
Cancel canned
G80 Canned
cycle
Simple drilling
G81 Canned
cycle
with dwell
(counterboring)
Peck drilling
retract)
Boring cycle,
out
Boring cycle,
rapid out
Back boring
G87 Canned
canned cycle
Boring canned
cycle, spindle
G88 Canned
stop, manual
out
Boring canned
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
save
parameters
Clamp of
G92
Motion maximum S
(alternate)
spindle speed
Cancel offset
parameters
Cancel offset
parameters
Offset
coordinate
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
surface speed
Return to initial
canned cycle
Return to initial
canned cycle
M Code List to
Control Machine
Functions
M
Category Function Notes
Codes
Optional Stop:
Enable
m03 Spindle ON
M03 M-Code
clockwise
Spindle ON (CCW
M04 M-Code
Rotation)
FADAL subroutine
M17 M-Code
return
End of Program,
Modes
Haas-Style
M97 M-Code
Subprogram Call
Return from
M99 M-Code
Subprogram