What Is the Standard Tool Language for CNC Machines?
G-code, the ISO 6983 word-address language every controller reads in some form. This page covers how a block is built, how CAM turns a CAD model into it, where machine dialects break portability, and how the language shows up in the tolerance and finish you receive.

In this article
- 1
- 2
- 3
- 4
- 5
- 6
- 7
The Standard Tool Language for CNC Machines Is G-Code
The standard tool language for CNC machines is G-code, standardized internationally as ISO 6983. It is a word-address language: each line, called a block, is a list of letter-number words that the controller reads left to right. G tells the machine what motion or mode to enter. X, Y, Z and often A, B, C give coordinates. F sets feed rate, S sets spindle speed, T selects a tool, M switches machine functions such as coolant or spindle direction.
A typical block looks like N120 G01 X45.0 Y12.5 Z-3.2 F800. The line number is optional. The G01 says move in a straight line at the commanded feed. The coordinates are the endpoint, not the path shape. The F word sets feed in mm/min or in/min depending on the controller parameter.
Two modal groups matter more than beginners expect. G00, G01, G02 and G03 belong to group 1, the motion group. G43, G44 and G49 belong to the tool length group. Only one code from a modal group can be active at a time, and it stays active until another code from the same group replaces it. Forget that, and a G02 from the roughing path can still be live when the finishing path starts.
Units come first. G20 selects inches, G21 selects millimeters. A program written for G21 and run under G20 moves 25.4 times further than intended. That single mismatch is the most common reason a first article is scrapped before anyone measures it.
What Each Word Type Does on the Machine
A G-code program is not one continuous instruction. It is a series of modes, each with a different job. The table below is the practical version we use when we review a program before a run.
Positioning words are absolute or incremental. G90 means every coordinate is measured from the part zero. G91 means every coordinate is measured from wherever the tool currently sits. Mixing the two inside one operation is legal on most controllers and almost always a mistake.
Cutter compensation deserves its own paragraph. G41 offsets the tool to the left of the programmed path, G42 to the right, and G40 cancels it. When the CAM system posts G41 with a D register, the operator can adjust the offset at the machine without editing the program. That is how a shop holds ±0.005 mm on a bore that was programmed to nominal.
Cycles compress a lot of code. G81 drills, G83 pecks with full retract, G84 taps, G76 bores. A canned cycle plus a list of hole positions can replace hundreds of lines. The risk is that cycle behavior varies between controllers more than straight moves do.
How a CAD Model Becomes G-Code
Almost no production part is programmed by hand today. A CAM programmer imports the CAD model, defines the stock, picks tools, sets stepover and stepdown, then chooses the machining strategy. The software calculates the toolpath and writes the G-code through a post-processor.
The post-processor is where the machine dialect enters the picture. A post configured for a Fanuc 31i will not run cleanly on a Siemens 840D without edits. M-code meanings differ, tool change syntax differs, and some controllers need specific safety blocks at the top of the file. A post is not a translation layer you can ignore. It encodes how that specific machine expects to be spoken to.
Feeds and speeds come from the material and the cutter, not from a default table. Aluminum 6061-T6 can run far faster than Ti-6Al-4V or Inconel at the same tool diameter. PEEK and other plastics need high surface speed but low chipload to avoid melting. The programmer sets these values, and they land in the F and S words.
Simulation runs before the program reaches the machine. The programmer checks for gouges, collisions with the fixture, and rapid moves that pass through the part. On a 5-axis job this step is not optional. A rotary move that looks fine in the CAM preview can put the holder through the table.
Where the Language Stops and the Machine Starts
G-code describes geometry and feed. It does not describe how the machine will deflect. A 4,000 mm long part on a traveling-column machine will flex under its own weight and under cutting load. The program can be perfect and the part still comes out tapered if the setup does not support it.
Thermal behavior sits outside the language too. A spindle that has run for three hours is not at the same length as a cold spindle. On a job holding ±0.005 mm, that drift is often larger than the tolerance itself. Warm-up cycles and in-process probing exist because the program alone cannot compensate for it.
Tool wear is the third boundary. G-code calls a tool by number, not by condition. After 200 holes in 17-4PH, that drill is no longer the drill the program assumed. Tool life management, offset updates, and inspection between operations are what keep the language honest.
This is why the language is necessary but not sufficient. Two shops can run the same G-code on comparable machines and deliver different parts. The difference is setup, tooling, and how often someone measures.
Dialect Differences That Break Portability
ISO 6983 defines the core, but it leaves room for extension. That room is where portability dies. Siemens uses CYCLE81 and CYCLE83 style calls rather than the plain G81 and G83 forms. Haas uses G187 for its own smoothing control. Fanuc has G05 and G05.1 for high-speed modes that other brands do not read.
Macros are the bigger gap. Fanuc custom macro B, Siemens R-parameters, and Haas macros all let a programmer write variables, loops and conditionals. A macro-driven program can be compact and self-checking. It is also locked to one controller family. If the part moves to another machine, the macro has to be rewritten, not just reposted.
High-speed machining modes are another split. G05.1 Q1 on a Fanuc control changes how the controller looks ahead through the block buffer. The same geometry with the same F and S words will produce a different surface finish with that mode on or off. Two machines, same program, different Ra.
For a buyer, this matters at the quoting stage. A part programmed for one controller family may need a fresh post and a fresh simulation before it can run anywhere else. That is engineering time, and it shows up in the price of a re-run.
How the Language Affects Tolerance and Surface Finish
A program does not hold a tolerance. The machine, the tool and the setup do. G-code only commands where the tool should go. Whether the cut lands within ±0.005 mm depends on machine geometry, thermal state, tool deflection and how the part is held.
Surface finish follows the same logic. The stepover between passes, the tool nose radius, and the feed per tooth set the theoretical Ra. On aluminum we typically see Ra 0.8–1.6 μm as machined, with Ra 0.2–0.8 μm where a finishing pass and a finer stepover are applied. A program copied from a steel job will not produce that on aluminum, and the reverse is worse.
Look-ahead behavior changes finish on complex geometry. Controllers with a high-speed mode will round corners slightly to keep feed up. That is a deliberate trade: cycle time down, corner accuracy slightly softer. On a part with a tight corner callout, the programmer has to slow down or turn the mode off.
The practical takeaway for an engineer is that the drawing callout and the G-code are two ends of the same chain. If the callout is tight, the program, the tooling and the inspection plan all have to match it.
G-Code Word Groups and What They Control
Modal groups follow ISO 6983. The entries below are the ones that decide whether a program runs or scraps.
| Word | Group | What it selects | Typical value |
|---|---|---|---|
| G00 | Motion | Rapid positioning move | Machine max rate |
| G01 | Motion | Linear feed move | F word sets rate |
| G02 / G03 | Motion | Circular arc CW / CCW | R or I, J, K |
| G20 / G21 | Units | Inch or millimeter input | Pick one, never both |
| G41 / G42 | Compensation | Cutter offset left / right | D register number |
| G43 / G49 | Tool length | Apply / cancel length offset | H register number |
| G81 / G83 | Canned cycle | Drill / peck drill | Retract plane, depth |
| G84 | Canned cycle | Tapping cycle | Pitch from F word |
| M03 / M05 | Spindle | Spindle on CW / stop | S word sets rpm |
| M06 | Tool change | Load tool from carousel | T word selects pocket |
| M08 / M09 | Coolant | Coolant on / off | Flood or mist |
| M30 | Program | End and rewind | No value |
When G-Code Portability Matters and When It Does Not
If the part will run on one machine family only, a controller-specific program with macros and high-speed modes is the faster route. If the part may move between shops or machine brands, keep the program close to plain ISO 6983 and accept a slightly longer cycle.
Questions Engineers Ask About G-Code
Is G-code the same on every CNC machine?
The core is. ISO 6983 fixes the meaning of G00, G01, G02, G03, G20, G21 and the basic M-codes.
The edges are not. Canned cycle syntax, high-speed modes, macro syntax and tool change blocks differ by controller family. A program that runs on a Fanuc control may need edits before it runs on a Siemens or Haas.
Do I need to supply G-code with my CAD file?
No. Send the 3D model and the 2D drawing with tolerances and finish callouts. We generate the toolpath and the G-code in CAM.
If you already have a proven program for a specific machine, mention it at quoting. It can shorten setup, but we still verify it against our machines and posts.
Can G-code alone guarantee a ±0.005 mm tolerance?
No. The program sets the path. The tolerance comes from the machine, the thermal state, the tool and the workholding.
That is why we inspect 100% before shipment and can supply reports on request. A tight callout needs a matching inspection plan, not just a matching line of code.
Why does the same program give a different finish on two machines?
Look-ahead, servo tuning and spindle behavior differ. A high-speed mode active on one controller and not the other changes corner rounding and effective feed.
Tool condition matters too. The same T number on a worn cutter cuts differently than on a fresh one.
What happens if a program is posted in inches but run in millimeters?
Every axis move is scaled by 25.4. A 50 mm move becomes 1,270 mm.
On most machines this trips a soft limit or an overtravel alarm before the tool reaches the part. If it does not, the part and often the fixture are lost.
Does 5-axis machining need different G-code?
The same language, plus rotary axis words. A, B and C address the rotary axes, and the post handles the transformation from part coordinates to machine coordinates.
That transformation is where most 5-axis errors originate. It is also why we simulate every 5-axis program before it runs.
Send a Model, Get a Program Review and a Quote
We read the drawing, flag the features that need a tighter program, and come back with a quotation and free DFM analysis within 12 hours.
12-hour quote100% inspectionNo minimum order quantity