Here is our Ultimate Guide to CNC Codes. Below is a list of CNC codes with a description of what they are.
Click on the code if you want to find out more including multiple examples to help you understand how to use them in your programs.
A - Rotation Around the X Axis
Rotates around the 4th axis of the machine if equipped.
B - Rotation Around the Y Axis
Rotates around the 5th axis of the machine if equipped.
C - Rotation Around the Z Axis
Rotates around the 6th axis of the machine if equipped.
D - Diameter Offset
Specifies the tool diameter offset to be used for cutter compensation (G41 and G42).
H - Height Offset
Specifies the height offset to be used when turning tool length compensation on (G43) or off (G49)
I - Radius Center in X Axis
Identifies the location of the center of a radius for a circular move relative to the current X axis location.
J - Radius Center in Y Axis
Identifies the location of the center of a radius for a circular move relative to the current Y axis location.
K - Radius Center in Z Axis
Identifies the location of the center of a radius for a circular move relative to the current Z axis location.
L - Number of Subprogram Repetitions
Used with the M98 subprogram call command. L lists how many times the subprogram will be repeated.
N - Program Line Number
Identifies the sequence or line number of the program. They are not required but they can help make a CNC program easier to follow.
O - Program Number
The program number is the first CNC word in the program.
P - Subprogram Number/Dwell Time
When used with an M98 code, P identifies the subprogram number.
When used with G04 or canned cycles, P specifies the amount of time to dwell.
Q - Peck Drill Depth
Used with G73 and G83 peck drilling cycles. Q identifies the depth of each drilling peck before the drill backs up to break chips.
R - Radius Size/Reference Plane
When used with G02 and G03, R specifies the size of the circular curve to be machined.
When used with a canned cycle such as G73, R specifies the location of the rapid plane.
T - Tool Number
Selects a tool to prepare it for tool change. M06 will cause the CNC to swap the currently loaded tool with the one selected with the T code.
Some machines do not require the use of a M06 code and will swap tools by simply using the T code.
; - End of Block
Signifies the end of a block of code. A single block will usually consist of one line of code.
Useful when testing code by stepping through the blocks in single block mode.
/ - Block Skip
Used together with a switch on the CNC control.
When the switch is on the machine will read and execute lines that start with the / character. When the switch is off, these lines will be ignored.