To convert STL to G-code, you slice the model. A slicer cuts the STL's triangle mesh into layers and writes every nozzle move, extrusion amount, temperature and fan command for one printer and one filament into a plain-text .gcode file. No converter can skip that step, because an STL holds only a shape: no layers, speeds or temperatures. You can slice in a desktop program such as PrusaSlicer or UltiMaker Cura, or in your browser with the STL to G-code Converter, which never uploads the model.
How to convert STL to G-code with Zutilium
The page opens with a sliced example cube. To slice your own model:
- Open the STL to G-code Converter and choose your Printer and Filament under Settings. The presets have not been tested on real printers, so open Start and end G-code and compare it with your printer maker's profile.
- Click Choose an STL file or drop the file on the tool. Check that Size matches the part and Mesh check reads "Closed and consistent".
- Under Placement, press Lay flat on the largest face or use Rotate 90° about X and the matching Y and Z buttons until the line below says the model fits.
- Set Layer height, Walls, Infill density, Supports and Bed adhesion. With Slice automatically when a model loads or a setting changes selected (the default), the page slices on its own (after a change, only when the last slice took under 4 seconds); otherwise press Slice to G-code.
- In the Toolpaths preview, step through the print with the Layer slider.
- Check Print time, Filament and Weight, then press the download button, which shows your file name (for example Download bracket.gcode). Copy it to an SD card or USB stick, or upload it through your printer's web interface.
The notes under the result flag layers slowed down to cool, parts too thin to print and unsupported overhangs. The time covers moves only, so add a few minutes for heating and leveling. Change a setting and the download stays disabled until the model is sliced again. Slicing runs in a background worker in your browser, so the STL is never uploaded; only your printer, filament and settings are kept, in local storage.
What slicing does to an STL file
An STL file lists the triangles of a model's surface. It has no units (a part drawn in inches loads 25.4 times too small) and nothing about how to print it. A slicer cuts the mesh into an outline at every layer, traces walls inward, fills the top and bottom layers solid and the inside with sparse infill, and adds supports and a skirt or brim. It then orders the paths, adds retractions, works out the filament for every line and wraps it all in your printer's start and end G-code.
G1 lines move the head and their E value feeds filament; M104 and M109 set the nozzle temperature (M109 waits until it is reached), and M140 and M190 do the same for the bed. Text after a semicolon is a comment. The calibration cube on the Creality Ender-3 preset starts like this:
;FLAVOR:Marlin
;TIME:1426
;Filament used: 1.204m
;Layer height: 0.2
...
G21 ; millimetres
G90 ; absolute coordinates
M82 ; absolute extrusion
M107 ; part cooling fan off
; ----- start G-code -----
; Creality Ender-3: no automatic bed levelling, so level the bed by hand first
M140 S60 ; start heating the bed
M104 S215 ; start heating the nozzle
M190 S60 ; wait for the bed
M109 S215 ; wait for the nozzle
G28 ; home all axes
...
;LAYER:0
G1 Z0.2 F300
G1 E-5 F1500
G0 X100 Y123.632 F9000
;TYPE:SKIRT
G1 E0 F1500
G1 X99.618 Y123.611 E0.01295 F1200
;TIME is the estimate in seconds. With absolute extrusion (M82), E is a running total, so G1 E-5 pulls 5 mm of filament back before the travel and G1 E0 pushes it forward again.
3D printer slicer settings that matter most
Zutilium's defaults for a 0.4 mm nozzle, and what each one changes:
| Setting | Default | What it changes |
|---|---|---|
| Layer height | 0.2 mm | Smoothness of slopes, and time; at most 80% of the nozzle |
| Walls | 2 | Most of a part's strength |
| Top solid layers / Bottom solid layers | 5 / 4 | Closed top and bottom surfaces |
| Infill density | 15%, Grid | Weight, time, support for the top |
| Supports | None, 50° | Columns under steep overhangs |
| Bed adhesion | Skirt | Primes the nozzle; Brim helps parts stick |
Prusa's layers and perimeters guide agrees: strength comes mostly from walls, not infill, and layers stay under 80% of the nozzle diameter.
Worked example: what each change costs
The Twisted vase example (about 55 × 59 × 70 mm, solid despite its name), sliced on the Creality Ender-3 preset with PLA, one change at a time (times are the tool's estimates):
| Change from the defaults | Layers | Estimated time | Filament |
|---|---|---|---|
| None (0.2 mm, 2 walls, 15%) | 350 | 2 h 43 min | 41.2 g |
| Layer height 0.12 mm | 583 | 4 h 16 min | 40.0 g |
| Layer height 0.28 mm | 250 | 2 h 03 min | 42.0 g |
| Walls 3 | 350 | 3 h 04 min | 45.9 g |
| Infill density 30% | 350 | 4 h 07 min | 66.1 g |
Thinner layers cost time, not plastic: 0.12 mm adds 1 h 33 min for about the same weight. An extra wall adds 21 minutes and 4.7 g; doubling infill to 30% adds 1 h 24 min and 24.9 g. For a stronger part, add a wall first.
Supports are costly too. The Bridge with overhangs (needs supports) example (65 × 20 × 25 mm) takes an estimated 39 minutes and 7.6 g with Supports on None, and the notes warn that about 886 mm² of underside has nothing below it. With Touching the build plate it takes 57 minutes and 11.0 g.
Selling prints? Set Price per kilogram (20 by default), and Copy summary copies the time, weight and cost for a quote. Then make an invoice, or work out Etsy's fees before pricing a listing (how Etsy fees add up).
Temperatures by filament
| Filament preset | Nozzle (first layer / rest) | Bed | Fan |
|---|---|---|---|
| PLA | 215 / 210 °C | 60 °C | 100% from layer 2 |
| PETG | 235 / 240 °C | 80 °C | 40% from layer 4 |
| ABS / ASA | 245 °C | 100 °C | 15% from layer 5 |
| TPU (95A) | 225 °C | 50 °C | 70% from layer 2 |
These are starting points: set Nozzle temperature and Bed temperature within the range on your spool. TPU is capped at 25 mm/s, and ABS and ASA warp without an enclosure. 3D printing can release ultrafine particles and chemical vapors, so print in a well-ventilated room, as NIOSH advises.
Firmware flavors: Marlin, Klipper and RepRapFirmware
The G-code flavor names the firmware dialect your printer reads. Zutilium's Firmware (G-code flavour) list offers Marlin (Creality, Prusa, Anycubic and most others), Klipper and RepRapFirmware (Duet). The choice only changes comments at the top of the file, such as ;FLAVOR:Marlin; moves and temperature commands are the same standard ones for all three. The real differences come from the preset:
- Extrusion mode. Absolute (M82) treats E as a running total, Relative (M83) gives each move its own amount. The Creality, Anycubic and generic Marlin presets use absolute; the Prusa, Klipper and RepRapFirmware presets use relative.
- Start G-code. The Voron presets call the PRINT_START macro from the printer's config, as Klipper's slicer notes recommend; the same page says the Marlin flavor works well with Klipper. The RepRapFirmware preset begins with T0 to select the first tool.
- Bed leveling. Marlin's G28 turns leveling off by default, so the Ender-3 V2, Ender-3 S1 and Kobra 2 presets add M420 S1 to switch the saved mesh back on. The MK3S+ preset probes with G80, the MK4 with G29; the plain Ender-3 expects a hand-leveled bed.
If your start code doesn't wait for the bed and nozzle, Zutilium adds heating and waiting commands before it.
First-layer checklist
Before and during the first layer:
- Level the bed, then set the nozzle height. Level by hand or load the saved mesh, and adjust the Z offset while the skirt prints. Gaps between lines mean the nozzle is too high; flattened, ridged lines mean too low (Prusa's first layer calibration guide).
- Keep it thick and slow. The default First layer height is 0.2 mm, as in Prusa's own profiles, and the presets print it at 20 to 30 mm/s.
- Mind the first-layer settings. First layer nozzle temperature applies to layer one only (215 °C for PLA, then 210 °C), and Fan off for the first keeps cooling off for 1 layer (3 for PETG, 4 for ABS and ASA).
- Choose adhesion. The default Skirt primes the nozzle and gives you a line to judge. Use Brim for small footprints, tall thin parts and ABS or ASA that lifts at the corners.
- Give PETG a release layer. It sticks hard to smooth PEI and glass, so use glue stick or a textured sheet.
- Stay with the printer. Watch the first layers from any new preset or edited start code, and stop the print if the nozzle scrapes or nothing sticks. Don't leave a printer unattended while it's switched on, as Prusa's knowledge base advises, and follow your printer's manual for safe operation.
Online slicer or desktop slicer?
A browser slicer covers everyday single-color prints and works where you can't install software, such as a Chromebook or a work laptop. Zutilium's takes STL files of up to 2,000,000 triangles and 300 MB.
Use a desktop slicer such as PrusaSlicer (free and open source, for any FDM printer), UltiMaker Cura, OrcaSlicer or Bambu Studio when the print needs:
- multi-material or multi-color printing
- tree or organic supports
- variable layer height, ironing, bridge detection or arc moves (G2/G3)
- different settings for different objects on one plate
- a Bambu Lab printer, which normally prints sliced files exported from Bambu Studio
- a profile your printer maker has tested (Zutilium's presets follow manufacturer documentation but are untested on real printers)
Troubleshooting
The model doesn't fit or is the wrong size
The placement line says why. Try Lay flat on the largest face or a quarter turn, then Scale to fit, which shrinks it to just under the largest size that fits. A part only a few millimeters across was probably drawn in inches: set Model units to Inches (× 25.4). If the part came with a DWG drawing, convert the DWG to PDF to read its dimensions.
The mesh has holes
While slicing, the tool closes gaps in an outline up to two line widths wide and bridges larger holes with a straight edge, and the notes say so. If parts are still missing in the preview, repair the mesh in PrusaSlicer, Meshmixer or Blender.
Thin details are missing
Anything thinner than half a line width (0.225 mm with the default 0.45 mm Line width) is left out, and the notes name the layers. Use a smaller nozzle and line width, or thicken the part.
Slicing stops or runs out of memory
A slice stops after ten minutes, and a print needing more than 8 million moves is refused. Use a thicker layer height, lower infill or fewer walls, simplify the mesh with Blender's Decimate modifier, or use a desktop browser or slicer.
Frequently asked questions
Can you convert STL to G-code without a slicer?
No. G-code needs layers, toolpaths, temperatures and speeds that an STL doesn't contain, so every STL to G-code converter is a slicer underneath. Online tools differ only in where that runs: your browser or a server.
Is there a free online slicer that doesn't upload your files?
Yes. Zutilium's STL to G-code Converter slices inside your browser, so the STL stays on your computer. Its 13 editable presets run from the Creality Ender-3 to the Voron 2.4 and include generic Marlin, Klipper and RepRapFirmware printers.
What are good slicer settings for PLA?
Start with 0.2 mm layers, 2 walls, 5 top and 4 bottom layers and 15% grid infill. Print at about 210 °C (215 °C for the first layer) on a 60 °C bed, with the fan on from layer 2, then adjust within the range on your spool.
Can I use the same G-code on a different printer?
Only on an identical printer with the same setup. G-code carries one printer's bed size, start code, leveling commands and temperatures, so on another machine it may print in the wrong place or skip leveling. Slice the STL again with the right profile.
Can you convert G-code back to STL?
Not reliably. G-code stores nozzle paths, not the model's surface, so anything rebuilt from it is approximate. Keep the original STL or CAD file.