3D printing & CAD · Intermediate
G-code
The line-by-line instructions a 3D printer or CNC machine follows
What is G-code?
G-code is the plain-text list of instructions a 3D printer or CNC machine follows, line by line. Each line tells the machine where to move, how fast, and what to do, such as heat the nozzle or push out plastic. A slicer writes it from your 3D model.
Think of it like this
Like turn-by-turn driving directions: go here, at this speed, then turn, with no view of the whole map, only the next instruction.
Where it fits in a 3D project
- Create
- Surface
- Rig
- Animate
- Render
- Export
Export: Saving and sharing the result: file formats, engines and printing.
How G-code works
- 01You load a 3D model into a slicer and choose print settings.
- 02The slicer cuts the model into layers and plans each nozzle path.
- 03It writes every move, speed and temperature as G-code lines.
- 04The printer reads the file line by line and builds the part.
G-code vs STL
| Property | G-code | STL |
|---|---|---|
| Describes | How to print the object | The shape of the object |
| Made by | A slicer | A 3D or CAD app |
| Works on | One printer with its settings | Any printer, through a slicer |
Keep and share the STL, since it works anywhere; G-code is a one-off output for a specific printer, material and set of settings.
Where G-code is used
- Running FDM 3D printers
- Controlling CNC mills, routers and laser cutters
- Custom start routines, like heating and bed leveling
Beginner tip
Never print G-code sliced for someone else’s printer. Bed size, nozzle and temperatures are baked in, so reslice the original model with your own printer profile.
Terms related to G-code
- 3D printing & CADSlicerThe program that turns a 3D model into layer-by-layer print instructions
- 3D printing & CAD3D printingBuilding a real object layer by layer from a 3D model
- 3D printing & CADFDM printingThe common home method that builds parts from melted plastic filament
- File formatsSTL fileThe standard 3D printing file: a model’s surface as a list of triangles
- 3D printing & CADLayer heightHow thick each printed layer is, trading speed against smoothness
G-code FAQ
Updated October 29, 2026 · Browse all 3D terms