G codes: Full list (Milling & Turning)

* Click the G Code to read the full explanation

What is a G code?

G-code is the common name for the most widely used CNC programming language. It was developed in the 1950s at MIT. The language is very “primitive” in today’s standards. All the commands are represented by codes (G01, G02, etc..) and not by meaningful words. Variables are represented by numbers(#500, #151, etc..) and not by words and conditional logic is very limited. Amazingly this 70-year-old language is still the industry standard. Several tool manufacturers developed higher-end Wizard-like languages such as Mazak – Mazatrol or Okuma – AOT, but none of them gained very high popularity.

The target of the code is to control the movements of a computerized controlled machine. The code basically “tells” the machine in what path to move from one coordinate to the next (Called “Toolpath”), and at what speed (Called “Feedrate”).



G code syntax

Sample short program

N10 O1000;
N20 T05;
N30 G01 A10 X40 Z60 F1.0 S1000;
N40 M05;

What does each letter in the program mean?

M Codes

“G” stands for Geometry and hence the G-Code commands are responsible for the movements of the machine that create the geometry of the part. “M” stands for Machine (or Miscellaneous) and the M-Codes are responsible for Machine commands that cause particular operations of the equipment. Unlike G-codes, which can appear multiple times on the same line, M-Code is limited to one code per line.

List of M-codes

* Press ⊕ to read the full explanation

Scroll to Top