3D printing and 3D files

How to turn an STL into G-code for your 3D printer

An STL describes a shape. Your printer needs something different: a list of moves, temperatures and extrusion amounts for every layer. That list is G-code, and the program that writes it from an STL is called a slicer. No online converter can do this well without knowing your exact printer and filament.

Pick a slicer

All of these are free: PrusaSlicer, UltiMaker Cura, Bambu Studio and OrcaSlicer. Use the one made for your printer brand if there is one, because it ships with tested profiles. Select your printer model when the slicer first starts.

Slice in five steps

  1. Open the STL (drag it into the slicer window).
  2. Check the size. STL has no units; if the model is tiny or enormous, it was exported in metres or inches and needs scaling.
  3. Place it flat on its largest face so it needs fewer supports.
  4. Choose the filament and a quality preset, typically 0.2 mm layers for a 0.4 mm nozzle.
  5. Click Slice, look through the layer preview, then export or send the G-code.

Settings worth understanding

Layer height trades detail for time. Infill sets how solid the inside is; 15 to 20% is plenty for most objects. Supports hold up overhangs steeper than about 45 degrees. Walls (perimeters) matter more for strength than infill: three walls make a sturdier part than 50% infill.

Check the result before printing

Every slicer has a layer preview; scroll through it to spot floating parts or missing supports. To inspect a G-code file you received from someone else, open it in the G-code viewer. Newer Prusa printers use binary G-code (.bgcode); BGCODE to G-code turns it back into readable text.

Model will not slice?

Holes, inside-out faces and loose pieces confuse slicers. Run the file through the STL repair tool first. If you only have a 3MF project, the slicer opens that directly too.

Questions

Can I convert STL to G-code online?

Only with a generic profile, which rarely suits your printer. A slicer with your printer profile is the reliable way.

Can G-code be turned back into STL?

Roughly: the toolpaths can be rebuilt into a mesh with G-code to STL, but detail is limited to the layers.

Which slicer is best?

The one with a tested profile for your printer.

More guides

How to turn a picture into a 3D modelFour ways to make a 3D model from a photo or drawing: raised reliefs, lithophanes, traced cut-outs and logos, plus what a single photo cannot do.How to make 3D files smallerShrink heavy 3D models for email, upload limits, AR and slicers: fewer triangles, a lighter format, smaller textures, and the main mistakes to avoid.How to view 3D files without installing softwareOpen STL, OBJ, FBX, GLB, STEP, 3MF, Blender and other 3D files in your browser, on a phone or with built-in apps, with nothing to install or upload.How to convert STL to STEP for editing in CADWhy CAD struggles with STL meshes, how converting to STEP rebuilds flat and round faces for editing, and what to expect for parts and for 3D scans.

All guides