Mar 17, 2026 Leave a message

Complete List of CNC Machining Center Program Codes

 

The programmable functions of CNC machine tools are divided into two categories:

One category is used to control the tool path, i.e., the movement of each feed axis, such as linear/circular interpolation, feed control, coordinate system origin offset and transformation, dimension unit setting, tool offset and compensation, etc. This category of functions is called preparatory functions, consisting of the letter G followed by two digits, also known as G-codes.

The other category of functions is called auxiliary functions, used to complete program execution control, spindle control, tool control, auxiliary equipment control, etc. Among these auxiliary functions, Tx x is used for tool selection, and Sx x x x is used to control the spindle speed. Other functions are implemented using M-codes consisting of the letter M followed by two digits.

1. Commonly Used G-Code Functions

G00 Positioning (Rapid Traverse)

G01 Linear Interpolation (Feed Rate)

G02 Clockwise Circular Interpolation

G03 Counterclockwise Circular Interpolation

G04 Pause, Precise Stop

G09 Precise Stop

G17 Select X/Y Plane

G18 Select Z/X Plane

G19 Select Y/Z Plane

G27 Return and Check Reference Point

G28 Return to Reference Point

G29 Return from Reference Point

G30 Return to Second Reference Point

G40 Cancel Tool Radius Compensation

G41 Left Tool Radius Compensation

G42 Right Tool Radius Compensation

G43 Tool Length Compensation +

G44 Tool Length Compensation -

G49 Cancel Tool Length Compensation

G52 Set Local Coordinate System

G53 Select Machine Coordinate System

G54 Select Workpiece Coordinate System 1

G55 Select workpiece coordinate system 2

G56 Select workpiece coordinate system 3

G57 Select workpiece coordinate system 4

G58 Select workpiece coordinate system 5

G59 Select workpiece coordinate system 6

G60 Single-direction positioning

G61 Precise stop mode

G64 Cutting mode

G65 Macro program call

G66 Modal macro program call

G67 Cancel modal macro program call

G73 Deep hole drilling fixed cycle

G74 Reverse thread tapping fixed cycle

G76 Fine boring fixed cycle

G80 Cancel fixed cycle

G81 Drilling fixed cycle

G82 Drilling fixed cycle

G83 Deep hole drilling fixed cycle

G84 Tapping fixed cycle

G85 Boring fixed cycle

G86 Boring fixed cycle

G87 Reverse boring fixed cycle

G88 Boring Fixed Cycle

G89 Boring Fixed Cycle

G90 Absolute Value Command Mode

G91 Incremental Value Command Mode

G92 Workpiece Zero Point Setting

G98 Fixed Cycle Return to Initial Point

G99 Fixed Cycle Return to R Point

2. Commonly Used M Code Functions

M00 Program Pause

M01 Conditional Program Stop

M02 Program End

M03 Spindle Forward Rotation

M04 Spindle Reverse Rotation

M05 Spindle Stop

M06 Tool Exchange

M08 Cooling On

M09 Cooling Off

M18 Spindle Orientation Cancel

M19 Spindle Orientation

M29 Rigid Tapping

M30 Program End and Return to Program Header

M98 Subroutine Call

M99 Subroutine End Return/Repeat Execution

3. Common Arithmetic

Addition: #i = #j + #k

Subtraction: #i = #j - #k

Multiplication: #i = #j * #k

Division: #i = #j / #k

Sine: #i = SIN[#j]

Arcsine: #i = ASIN[#j]

Cosine: #i = COS[#j]

Inverse Cosine: #i = ACOS[#j]

Tangent: #i = TAN[#j]

Arctangent: #i = ATAN[#j]

Square Root: #i = SQRT[#j]

Absolute Value: #i = ABS[#j]

Rounding: #i = ROUND[#j]

Integer Rounding: #i = FIX[#j]

Integer Rounding Down: #i = FUP[#j]

Natural Logarithm: #i = LN[#j]

Exponential Function: #i = EXP[#j]

OR: #i = #j OR #k

XOR: #i = #j X OR #k

AND: #i = # AND #k

Convert from BCD to BIN: #i = BIN[#j]

Convert from BIN to BCD: #i = BCD[#j]

4. Logical Operators

EQ: Equal to

NE: Not equal to

GT: Greater than

GE: Greater than or equal to

LT: Less than

LE: Less than or equal to

5. Program Transfer and Loops

Unconditional Transfer: GOTO
Conditional Transfer: IF [conditional expression]

IF [conditional expression] GOTO n, if the condition is met, jump to program segment n

IF [conditional expression] THEN, e.g.: IF [#I=#J] THEN #K=0

6. Loop Statements

WHILE [conditional expression] Dom (m=1,2,,3)



If the condition is met, execute the program from Dom to ENDm (until the condition is no longer met); otherwise, execute the program after 

 

 

Send Inquiry

whatsapp

skype

E-mail

Inquiry