Professional Documents
Culture Documents
G&M Codes make up the most of the contents of the CNC program. The definition of each class of code and specific meanings of
the most important codes are covered next.
G-Codes
Codes that begin with G are called preparatory words because they prepare the machine for a certain type of motion. The most
common G-codes are shown in Table 5.3 and a complete list and their meaning is included in Appx D - G-M Codes Reference.
Note: Older controls required G-codes to be written with a leading zero, like G01. Most machines now
allow the leading zero to be omitted, as shown in the table below.
Table 5.3: Common G-Codes
Code
Meaning
G0
G1
G2
Clockwise arc.
G3
Counterclockwise arc.
G4
Dwell.
G28
G40
G41
G42
G43
G54
G55
G56
G57
G58
G59
G80
G81
G82
G83
G84
Tap cycle.
G90
G91
G98
G99
M-Codes
Codes that begin with M are called miscellaneous words. They control machine auxiliary options like coolant and spindle
direction. Only one M-code can appear in each block of code.
The table below lists the most common M codes and their meaning. A complete list of M-codes is included in Appx D - G-M Codes
Reference.
Table 5.4: Common M-Codes
Code
Meaning
M0
M1
Optional stop. Only executed if Op Stop switch on the CNC control is turned ON.
M2
End of program.
M3
Spindle on Clockwise.
M4
Spindle on Counterclockwise.
M5
Spindle stop.
M6
Change tool.
M8
Coolant on.
M9
Coolant off.
M30