From CNC.xyz Wiki
(Redirected from Category:G-Code)
Jump to: navigation, search

G-Code (also known as the RS-274 standard) is the numerical control language that is used to program most CNC Machines. There are several variations to the code used and not all G-code is created equally. Please check with the CNC control software (Mach3, LinuxCNC, UCCNC, Grbl) for specific reference and setup with CNC processors.

G-Code Code Description
G00 Rapid Positioning
G01 Linear Interpolation
G02 Circular Interpolation, Clockwise
G03 Circular Interpolation, Counterclockwise
G04 Dwell
G10 Coordinate System Origin Setting
G17 XY Plane Selection
G18 XZ Plane Selection
G19 YZ Plane Selection
G20 Unit Selection: Inch
G21 Unit Selection: MM
G27 Verify Home
G28 Home Return (Soft Home)
G30 Home
G33 Lathe Thread Cycle
G40 Cancel Cutter Compensation
G41 Cutter Compensation Left
G42 Cutter Compensation Right
G43 Tool Length Offset
G49 Cancel Tool Length Offset
G53 Motion in Machine Coordinate System
G54 Select Coordinate System 1
G55 Select Coordinate System 2
G56 Select Coordinate System 3
G57 Select Coordinate System 4
G58 Select Coordinate System 5
G59 Select Coordinate System 6
G59.1 Select Coordinate System 7
G59.2 Select Coordinate System 8
G59.3 Select Coordinate System 9
G65 Subroutine
G80 Cancel Motion Modes
G81 Drilling Cycle
G82 Drilling Cycle with Dwell
G83 Drilling Cycle with Peck
G85 Boring Cycle, No Dwell, Feed Out
G86 Boring Cycle, Stop, Rapid Out
G87 Back Boring Cycle
G88 Boring Cycle, Stop, Manual Out
G89 Boring Cycle, Dwell, Feed Out
G90 Absolute Distance Mode
G91 Incremental Distance Mode
G92 Coordinate System Offset
G92.2 Cancel Coordinate System Offsets
G92.3 Restore Axis Offsets
G93 Inverse Time Feed Mode
G94 Feed per Minute Mode
G95 Feed per Revolution Mode
G96 Constant Surface Speed
G97 RPM Mode
G98 Initial Level Return in Canned Cycles
G99 R-Point Level Return in Canned Cycles


The following is a list of the most typical M-Commands that are supported by every major CNC motion controller program. Beyond M09, most software will allow the creation of custom M-Commands. Consult the documentation for your specific commands associated with your software and machine. Not all commands will be available.

M-Command Code Description
M00 Program Stop
M01 Optional Stop
M02 Program End
M03 Spindle On, Clockwise
M04 Spindle On, Counter-Clockwise
M05 Spindle Off
M06 Tool change
M07 Mist Coolant On
M08 Flood Coolant On
M09 Coolant Off