What is G-code in CNC?

G-code is the common name for the most widely used computer numerical control (CNC) programming language, which has many implementations. Used mainly in automation, it is part of computer-aided engineering.

The first numerical computer control language was developed by MIT in the late 1950s. The earliest version of G-Code was standardized by the Electronic Industries Alliance in the early 1960s.
Generally there is one international standard – ISO 6983. Usual filename extensions .tap, .cnc, .nc and several others.

G-code instructions are provided to a machine controller (industrial computer) that tells the motors where to move, how fast to move, and what path to follow.

The most common situation is that a cutting tool is moved according to these instructions, cutting away excess material to leave the finished work piece.

Today, the exact, reproducible manufacturing afforded by G-code and similar languages is used in the creation of all kinds of military and scientific equipment and consumer goods.

G-code example for a plasma cutting machine:

G21
G90
G00 X5.Y5.
M07
G01 X105.Y5.
G01 X105.Y105.
G01 X5.Y105.
G01 X5.Y5.
M08
M02

Description:

G21Metric units;
G90Absolute programming;
G00 X5.Y5.Positioning at rapid speed: “X5.” means to go to “5mm” on the X axis, and “Y5.” means to go to “5mm” on the Y axis;
M07Start Cutting;
G01 X105.Y5.Linear interpolation (machining a straight line):“X105.” means to go to “105mm” on the X axis, and “Y5.” means to go to “5mm” on the Y axis;
G01 X105.Y105.Linear interpolation (machining a straight line):“X105.” means to go to “105mm” on the X axis, and “Y105.” means to go to “105mm” on the Y axis;
G01 X5.Y105.Linear interpolation (machining a straight line):“X5.” means to go to “5mm” on the X axis, and “Y105.” means to go to “105mm” on the Y axis;
G01 X5.Y5.Linear interpolation (machining a straight line):“X5.” means to go to “5mm” on the X axis, and “Y5.” means to go to “5mm” on the Y axis;
M08Stop Cutting;
M02End Program;