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
- Open the STL (drag it into the slicer window).
- Check the size. STL has no units; if the model is tiny or enormous, it was exported in metres or inches and needs scaling.
- Place it flat on its largest face so it needs fewer supports.
- Choose the filament and a quality preset, typically 0.2 mm layers for a 0.4 mm nozzle.
- 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.