Skip to content

CNC G-Code List
CNC G-Code List

CNC G-Code List: Commands and Programming Functions

CNC technology forms the backbone of modern automated manufacturing. To operate CNC machines effectively, programmers and machinists rely on G-codes, the standardized language that guides tool movement, machining cycles, coordinate definitions, and critical control functions. A well structured G-code list helps professionals understand how each command influences the machining process, supports troubleshooting, and enables optimal productivity and precision.

This comprehensive guide explains the essential CNC G-codes, how they work, and the purpose behind each category. Whether you are new to CNC programming or looking to refine your knowledge, the following explanations will help you navigate the most widely used CNC-code list with confidence.

cnc g-codes

CNC G-Codes: Definition and Significance

G-codes are the foundation of the CNC programming language. They define how a CNC machine behaves, how it moves along the axes, and how each machining action is performed. These commands allow machines to operate autonomously by following exact numerical instructions.

In the world of CNC machining, which you can explore more on Norck’s dedicated page here: CNC machining, G-codes play a critical role in controlling tool movement and ensuring every process is executed with precision.

G-codes were standardized under the RS 274 format, and while machine manufacturers may introduce variations, the core structure of G-code programming remains consistent across mills, lathes, and multi axis machines.

What is the Purpose of G-Codes

G-codes instruct CNC machines on how to move, at what speed to travel, which type of interpolation to apply, and how to interpret coordinates. Their core purposes include:

  • Controlling linear and circular movements

  • Defining active coordinate systems

  • Running drilling, tapping, and boring cycles

  • Setting feed rates and spindle speeds

  • Handling tool changes and tool offsets

  • Managing plane selection and machining direction

  • Controlling auxiliary elements such as coolant and spindle rotation

Without G-codes, CNC machines would have no method of interpreting digital instructions, and automation would not be possible.

Basic Principles of CNC Programming

CNC programming is built on structured coding practices that ensure predictable machine behavior. Key principles include:

  • Programs are written in blocks, with each block containing a command

  • Modal commands remain active until replaced

  • Non modal commands affect only the current block

  • Movements are defined using coordinate values for X, Y, and Z

  • Feed and speed parameters control cutting quality

  • Interpolation and plane selection determine how arcs and straight lines are formed

Understanding these principles allows programmers to create efficient, accurate, and safe machining instructions.

Primary Motion Codes G00, G01, G02, G03

Motion codes are some of the most used G-codes in CNC programming. They define how the machine moves from one point to another and what type of interpolation should be used.

G00 Rapid Positioning

G00 moves the machine tool at maximum speed to a specific coordinate. It is intended only for positioning and not for cutting operations. Since rapid movement ignores feed rate settings, it must be used carefully to avoid potential collisions or unexpected tool paths.

Example
G00 X50 Y30 Z10

G01 Linear Feed Motion

G01 instructs the machine to follow a straight line at the defined feed rate. It is used for contouring, slotting, facing, and any operation that requires linear cutting.

Example
G01 X120 Y40 F250

G02/G03 Circular Interpolation

G02 and G03 enable circular tool movement:

  • G02 clockwise arcs

  • G03 counterclockwise arcs

Circular interpolation requires specifying an endpoint and either a radius R or center coordinates defined with I, J, and K.

Example
G03 X90 Y60 R25 F200

Coordinate Systems and Plane Selection

CNC machines must understand where they are operating and which plane the toolpath should follow. These G-codes define the programming reference system and working orientation.

G90 Absolute and G91 Incremental

  • G90 Absolute Mode uses a fixed zero point as the reference for all coordinates.

  • G91 Incremental Mode references each movement based on the current tool position.

Switching between these modes allows greater flexibility when programming complex shapes.

Example
G90 X40 Y20
G91 X10 Y5

G17, G18, G19 Working Plane Definition

Plane selection is essential for circular interpolation and cycles. These commands define which plane the tool is operating within:

  • G17 XY plane

  • G18 ZX plane

  • G19 YZ plane

These settings ensure the machine interprets circular movements correctly depending on the plane.

Essential Canned Cycles G81 to G84

Canned cycles simplify repetitive machining actions such as drilling or tapping. They allow programmers to perform multi step operations using only one line of code.

G81 Simple Drilling

G81 performs a basic drilling cycle. The machine rapids to position, feeds to depth, and retracts to the clearance plane.

Example
G81 X20 Y35 Z negative ten R3 F150

G83 Peck Drilling

G83 is designed for deep hole drilling where chips must be cleared repeatedly. The tool retracts after each peck to reduce heat and improve chip removal.

Example
G83 X20 Y35 Z negative fifty Q5 F120

G84 Tapping Cycle

G84 performs tapping operations. It synchronizes spindle rotation with the tool feed to cut internal threads.

Example
G84 X15 Y40 Z negative twelve R2 F80

Tool and Cutter Compensation Codes

Compensation codes help the CNC machine adjust for tool length, radius, and tool selection to ensure accurate cutting.

T Tool Change Command

The T code selects the active tool in the program. Many machines require an accompanying M06 command to complete the tool change.

Example
T03 M06

G41 G42 Cutter Radius Compensation

Cutter compensation adjusts the toolpath to account for tool diameter:

  • G41 offsets the tool left of the programmed contour

  • G42 offsets the tool right of the programmed contour

This feature is essential when machining precise contours or compensating for tool wear.

Example
G41 D01

G43 Tool Length Compensation

G43 uses stored tool length values to adjust the Z axis position and ensure accurate depth during operations.

Example
G43 H03 Z50

Program Control and Auxiliary M Codes

M codes control machine functions that are not related to movement. These functions support the machining environment and help define program flow.

M03 M05 Spindle Control

  • M03 activates clockwise spindle rotation

  • M05 stops the spindle

These codes are typically used with an S code that defines spindle speed.

M08 M09 Coolant Control

  • M08 turns coolant on

  • M09 turns coolant off

Coolant improves tool life, prevents overheating, and enhances chip evacuation.

M30 Program End and Reset

M30 ends the program and resets it to the beginning. This makes the machine ready to run the next cycle immediately.

cnc g-code list

Speed S and Feed F Functions

Speed and feed commands define the cutting conditions for safe and efficient machining.

Setting Spindle Speed S

The S command sets the spindle speed in revolutions per minute. It is used alongside M03 or M04 to activate spindle rotation.

Example
S1500 M03

Selecting the correct spindle speed is crucial for maintaining tool performance and achieving high quality surface finishes.

Defining Feed Rate F

The F command sets the feed rate. It determines how quickly the tool moves along the programmed path.

Example
F250

Feed rates impact tool wear, cutting temperature, and part accuracy. Programmers adjust feed values based on material hardness, tool type, and machining strategy.

Conclusion

Understanding a full G-code list and the role of essential CNC G-codes allows machinists and engineers to program with confidence, reduce errors, and improve machining precision. From motion control to drilling cycles, tool compensation, and auxiliary functions, each command contributes to a smooth and reliable CNC workflow. Mastering these codes is vital for improving productivity, extending tool life, and ensuring consistent part quality in any automated production environment.

Next article What Is Electrical Discharge Machining?