G-Codes

TechTipsMachining knowledge, made practical

CNC Programming Reference

G‑Code Engineering Reference

A searchable technical guide to common preparatory functions used in CNC milling and turning. Select any code to review its purpose, engineering interpretation, and controller-specific considerations.

i

Technical reference basis: This guide follows general ISO/FANUC-style programming conventions. G-code syntax, modal groups, parameters, and supported functions vary by control manufacturer, software version, machine builder, and installed options. Always validate commands against the official manuals for the specific machine and control before execution.

85 commands shownSelect a code for the engineering note
Code Function Milling Turning
Rapid positioning
Linear interpolation
Circular interpolation, clockwise
Circular interpolation, counterclockwise
Dwell
High-precision contour control (HPCC)
AI Advanced Preview Control
Non-uniform rational B-spline (NURBS) Machining
Imaginary axis designation
Exact stop check, non-modal
Programmable data input
Data write cancel
XY plane selection
ZX plane selection
YZ plane selection
Programming in inches
Programming in millimeters (mm)
Return to home position (machine zero, aka machine reference point)
Return to secondary home position (machine zero, aka machine reference point)
Feed until skip function
Single-point threading, longhand style (if not using a cycle, e.g., G76)
Constant-pitch threading
Single-point threading, longhand style (if not using a cycle, e.g., G76)
Variable-pitch threading
Tool radius compensation off
Tool radius compensation left
Tool radius compensation right
Tool height offset compensation negative
Tool height offset compensation positive
Axis offset single increase
Axis offset single decrease
Axis offset double increase
Axis offset double decrease
Tool length offset compensation cancel
Define the maximum spindle speed
Scaling function cancel
Position register (programming of vector from part zero to tooltips)
Local coordinate system (LCS)
Machine coordinate system
Work coordinate systems (WCSs)
Extended work coordinate systems
Exact stop check, modal
Automatic corner override
Default cutting mode (cancel exact stop check mode)
Rotate coordinate system
Turn off coordinate system rotation
Fixed cycle, multiple repetitive cycle, for finishing (including contours)
Fixed cycle, multiple repetitive cycle, for roughing (Z-axis emphasis)
Fixed cycle, multiple repetitive cycle, for roughing (X-axis emphasis)
Fixed cycle, multiple repetitive cycle, for roughing, with pattern repetition
Peck drilling cycle for milling – high-speed (NO full retraction from pecks)
Peck drilling cycle for turning
Tapping cycle for milling, lefthand thread, M04 spindle direction
Peck grooving cycle for turning
Fine boring cycle for milling
Threading cycle for turning, multiple repetitive cycle
Cancel canned cycle
Simple drilling cycle
Drilling cycle with dwell
Peck drilling cycle (full retraction from pecks)
Peck drilling cycle (full retraction from pecks)
Tapping cycle, righthand thread, M03 spindle direction, rigid toolholder
Tapping cycle, lefthand thread, M04 spindle direction, rigid toolholder
boring cycle, feed in/feed out
boring cycle, feed in/spindle stop/rapid out
boring cycle, backboring
boring cycle, feed in/spindle stop/manual operation
boring cycle, feed in/dwell/feed out
Absolute programming
Fixed cycle, simple cycle, for roughing (Z-axis emphasis)
Absolute arc programming
Incremental programming
Incremental arc programming
Position register (programming of vector from part zero to tool tip)
Threading cycle, simple cycle
Feedrate per minute
Fixed cycle, simple cycle, for roughing (X-axis emphasis)
Feedrate per revolution
Constant surface speed (CSS)
Constant spindle speed
Return to initial Z level in canned cycle
Feedrate per minute (group type A)
Return to R level in canned cycle
Feedrate per revolution (group type A)
Tool length measurement

Engineering Foundations

Fundamentals of G-Code and Computer Numerical Control (CNC)

Computer Numerical Control (CNC) technology relies fundamentally on G-code (Geometric code), a standardized programming language utilized to orchestrate automated manufacturing processes. Rather than representing distinct programming modalities, G-code functions as the precise instruction set interpreted by a CNC machine to synthesize raw materials into specific geometries. For these automated systems to execute operations successfully, the underlying program requires explicitly defined initial coordinates, specific trajectories, and absolute vector endpoints.

Structurally, G-code instructions dictate multi-axis motion pathways and regulate critical operational variables depending on the specific machining system and tooling configuration. Beyond spatial positioning, these alphanumeric commands specify tool selection, rotational axes, feed rates, travel limits, and system-level electrical parameters. Consequently, G-code serves as the vital communicative bridge that translates digital computer-aided designs (CAD/CAM) into highly repeatable, high-precision physical components.

Continue the Engineering Conversation

Receive practical machining guidance, CNC programming insights, tooling knowledge, and new technical resources from our engineering team.

No gated content. No additional requirements. Unsubscribe at any time.

From the screen to the spindle

The program is only half of it. Tooling that holds size run after run is the other half.

Browse All Tooling → End Mills Carbide Inserts