3/15/2017 CNC GCode and MCode Reference for CNC Machines
PRODUCTS ABOUT BLOG COOKBOOKS DIY CNC PROJECTS QUESTIONX
Free Trials HELP
GCode and MCode Reference
for Milling
GCode Tools Milling Turning
These are the common gcodes and mcodes for milling that GWizard Editor supports for
Mills. Code categories are the groupings for the gcode Wizard (type Ctrl+G for the Wizard).
Function tells what the gcode does, Notes gives a little more information such as the
parameters, and Tutorial is a link (if any) to a tutorial from our Online GCode Tutorial that uses
GWizard Editor to teach how to program the gcode.
Pssst! Hey, if you're here looking up gcodes, maybe you'd like to find an
easier way. What could be better than software that tells you exactly what
each gcode does in plain English?
That's what GWizard Editor is like.
Feeds and Speeds Calculator: START YOUR FREE TRIAL NOW ×
http://www.cnccookbook.com/CCCNCGCodeRef.html 1/7
3/15/2017 CNC GCode and MCode Reference for CNC Machines
GCode is complicated.
GWizard Editor makes it easy.
Try It Free!
Code Category Function Notes Tutorials
G00 and MDI.
Move in a straight line at rapids XYZ of
G00 Motion
speed. endpoint Linear Motion: G00 and
G01
Move in a straight line at last G01 and MDI.
XYZ of
G01 Motion speed commanded by a
endpoint Linear Motion: G00 and
(F)eedrate G01
G02 Motion Clockwise circular arc at G02 / G03 Tutorial and
(F)eedrate XYZ of Examples
endpoint
IJK relative
to center
Feeds and Speeds Calculator: START YOUR FREE TRIAL NOW ×
http://www.cnccookbook.com/CCCNCGCodeRef.html 2/7
3/15/2017 CNC GCode and MCode Reference for CNC Machines
R for radius
XYZ of
endpoint
Counterclockwise circular arc at G02 / G03 Tutorial and
G03 Motion IJK relative
(F)eedrate Examples
to center
R for radius
P for
Precise Timing and
milliseconds
Speed: Dwell, Exact
G04 Motion Dwell: Stop for a specified time.
Stop, Backlash
X for
Compensation
seconds
G05 Motion FADAL NonModal Rapids
Precise Timing and
Speed: Dwell, Exact
G09 Motion Exact stop check
Stop, Backlash
Compensation
G10 Compensation Programmable parameter input
Turn Polar Coordinates OFF, G15/G16 Polar
G15 Coordinate
return to Cartesian Coordinates Coordinates
G15/G16 Polar
G16 Coordinate Turn Polar Coordinates ON
Coordinates
CNC GCode
G17 Coordinate Select XY plane
Coordinates
CNC GCode
G18 Coordinate Select XZ plane
Coordinates
CNC GCode
G19 Coordinate Select YZ plane
Coordinates
G20 and G21: Unit
G20 Coordinate Program coordinates are inches
Conversion
G20 and G21: Unit
G21 Coordinate Program coordinates are mm
Conversion
G28: Return to
G27 Motion Reference point return check
Reference Point
G28: Return to
G28 Motion Return to home position
Reference Point
Return from the reference G28: Return to
G29 Motion
position Reference Point
Return to the 2nd, 3rd, and 4th G28: Return to
G30 Motion
reference point Reference Point
Constant lead threading (like G01
G32 Canned
synchronized with spindle)
Feeds and Speeds Calculator: START YOUR FREE TRIAL NOW ×
G40 Compensation Tool cutter compensation off
http://www.cnccookbook.com/CCCNCGCodeRef.html 3/7
3/15/2017 CNC GCode and MCode Reference for CNC Machines
(radius comp.)
Tool cutter compensation left
G41 Compensation
(radius comp.)
Tool cutter compensation right
G42 Compensation
(radius comp.)
Apply tool length compensation
G43 Compensation
(plus)
Apply tool length compensation
G44 Compensation
(minus)
G49 Compensation Tool length compensation cancel
G50 Compensation Reset all scale factors to 1.0
G51 Compensation Turn on scale factors
Local workshift for all coordinate
G52 Coordinate
systems: add XYZ offsets
Machine coordinate system
G53 Coordinate
(cancel work offsets)
Work coordinate system (1st
G54 Coordinate
Workpiece)
Work coordinate system (2nd
G55 Coordinate
Workpiece)
Work coordinate system (3rd
G56 Coordinate
Workpiece)
Work coordinate system (4th
G57 Coordinate
Workpiece)
Work coordinate system (5th
G58 Coordinate
Workpiece)
Work coordinate system (6th
G59 Coordinate
Workpiece)
Precise Timing and
Speed: Dwell, Exact
G61 Other Exact stop check mode
Stop, Backlash
Compensation
G62 Other Automatic corner override
G63 Other Tapping mode
G64 Other Best speed path
Subprograms and
G65 Other Custom macro simple call
Macros
G68 and G69 Tutorial
G68 Coordinate Coordinate System Rotation
and Examples
Cancel Coordinate System G68 and G69 Tutorial
G69 Coordinate
Rotation and Examples
High speed drilling cycle (small
G73 Canned
retract)
G74 Canned Left hand tapping cycle
G76 Canned Fine boring cyle
G80 Canned Cancel canned cycle
Feeds and Speeds Calculator:
START YOUR FREE TRIAL NOW ×
http://www.cnccookbook.com/CCCNCGCodeRef.html 4/7
3/15/2017 CNC GCode and MCode Reference for CNC Machines
G81 Canned Simple drilling cycle
Drilling cycle with dwell
G82 Canned
(counterboring)
G83 Canned Peck drilling cycle (full retract)
G84 Canned Tapping cycle
Boring canned cycle, no dwell,
G85 Canned
feed out
Boring canned cycle, spindle
G86 Canned
stop, rapid out
G87 Canned Back boring canned cycle
Boring canned cycle, spindle
G88 Canned
stop, manual out
Boring canned cycle, dwell, feed
G89 Canned
out
Absolute programming of XYZ
G90 Coordinate
(type B and C systems)
Absolute programming IJK (type
G90.1 Coordinate
B and C systems)
Incremental programming of XYZ
G91 Coordinate
(type B and C systems)
Incremental programming IJK
G91.1 Coordinate
(type B and C systems)
Offset coordinate system and
G92 Coordinate
save parameters
G92
Motion Clamp of maximum spindle speed S
(alternate)
Cancel offset and zero
G92.1 Coordinate
parameters
Cancel offset and retain
G92.2 Coordinate
parameters
Offset coordinate system with
G92.3 Coordinate
saved parameters
Units per minute feed mode.
G94 Motion
Units in inches or mm.
Units per revolution feed mode.
G95 Motion
Units in inches or mm.
G96: Constant Surface
G96 Motion Constant surface speed
Speed
G96: Constant Surface
G97 Motion Cancel constant surface speed
Speed
Return to initial Z plane after
G98 Canned
canned cycle
Return to initial R plane after
G99 Canned
canned cycle
Feeds and Speeds Calculator: START YOUR FREE TRIAL NOW ×
http://www.cnccookbook.com/CCCNCGCodeRef.html 5/7
3/15/2017 CNC GCode and MCode Reference for CNC Machines
MCodes
Code Category Function Notes Tutorials
M00 MCode Program Stop (nonoptional)
Optional Stop: Operator Selected
M01 MCode
to Enable
M02 MCode End of Program
M03 MCode Spindle ON (CW Rotation) M03 and MDI.
M04 MCode Spindle ON (CCW Rotation)
M05 MCode Spindle Stop M05 and MDI.
M06 MCode Tool Change
M07 MCode Mist Coolant ON M07 and MDI.
M08 MCode Flood Coolant ON M08 and MDI.
M09 MCode Coolant OFF M09 and MDI.
M17 MCode FADAL subroutine return
Rigid Tapping Mode on Fanuc
M29 MCode
Controls
End of Program, Rewind and
M30 MCode
Reset Modes
Subprograms and
M97 MCode HaasStyle Subprogram Call
Macros
Subprograms and
M98 MCode Subprogram Call
Macros
Subprograms and
M99 MCode Return from Subprogram
Macros
Bonus: Check Out our Other CNC Cookbooks for More InDepth
CNC Information!
If you're a CNC Beginnner, check out our CNC Beginner's Cookbook. It'll get you up to
speed with a solid CNC foundation fast.
We also have Cookbooks for Feeds and Speeds, GCode Programming, CNC
Manufacturing and Shop Management, DIY CNC, and don't forget the CNC Cookbook
Blogwith over 2 million visitors a year it's the most popular CNC blog by far on the web.
Feeds and Speeds Calculator: START YOUR FREE TRIAL NOW ×
http://www.cnccookbook.com/CCCNCGCodeRef.html 6/7
3/15/2017 CNC GCode and MCode Reference for CNC Machines
http://www.cnccookbook.com/CCCNCGCodeRef.html 7/7