G-code
What is it?
G-code is a low-level programming language/instruction set that tells CNC machines and 3D printers how to move and deposit or remove material. It consists of lines such as motion commands (e.g. G0/G1), feed rates (F), and machine-specific M-codes for functions like coolant or spindle control. Makers typically obtain G-code from a slicer (for 3D printing) or CAM software (for CNC), which converts a model into a sequence of machine instructions. There are multiple dialects (e.g. Marlin, GRBL, RepRap), and it’s common to edit start/end scripts or tweak G-code manually for calibration, safety, or process optimization.
Practical example
A common FabLab workflow: you design a part in CAD, load it into a slicer, and export a .gcode file that you send to the 3D printer. A line from that file might read: "G1 X50 Y25 Z0.2 E1.5 F1800" — meaning move to X=50, Y=25, Z=0.2 mm while extruding 1.5 units of filament at a feed rate of 1800 mm/min. Makers often open and tweak G-code files to insert pauses for filament change, add additional retraction, or modify start-up scripts (e.g. bed/heat settings) and they frequently run a simulation preview first to catch errors. For CNC milling, the same idea applies but you'll also see S for spindle speed, M-codes for coolant or tool changes, and paths tuned for cutting feeds and depths.
Test your knowledge
In the G-code line "G1 X50 Y25 Z0.2 E1.5 F1800", which parameter controls the amount of filament extruded?