STL to G-code
An STL describes a shape. A printer does not understand shapes — it understands movements. The program that turns one into the other is a slicer, and choosing one and setting it up properly is most of what separates a good print from a bad one.
We do not convert STL to G-code, and no honest web tool does. G-code is written for one specific printer, using its nozzle size, its bed size, its temperatures and its start-up sequence. A file generated without those can drive the nozzle into the bed. You need a slicer on your own computer, and the good ones are free.
Why an STL cannot be printed directly
An STL file is a list of triangles describing the surface of an object. That is all it is. There is nothing in it about temperature, speed, how thick each layer should be, where the plastic should start and stop, or what machine is going to make it. The same STL might be printed on a machine with a 0.2 mm nozzle at 190 degrees or one with a 0.8 mm nozzle at 260, and the file has no opinion either way.
G-code is the opposite kind of file. It is a list of instructions for one machine: move to this point at this speed, push this much filament, set the hot end to this temperature, turn the fan on. A single line looks like `G1 X102.4 Y98.7 E0.0432 F1800` — go to that coordinate, extruding that much filament, at that feed rate. A medium print is a few million of those lines.
Turning the first into the second is called slicing, because the first thing the program does is cut the model into horizontal layers. Then, for each layer, it works out the outline, how to fill the inside, where the object needs support underneath it, and the exact path the nozzle will take. Every one of those decisions depends on the machine and the material.
Why we do not offer this as a web tool
This is the one place on this site where the honest answer is that you need to install something. It is worth explaining why, because plenty of sites do offer an STL to G-code button.
G-code contains machine-specific commands that run before and after your object is printed. The start sequence homes the axes, heats the bed and the nozzle in a particular order, and often wipes the nozzle along the edge of the bed. The end sequence retracts, lifts, moves the head out of the way and turns the heaters off. Those sequences are different for every printer, and some of them are different for every firmware version of the same printer.
Get them wrong and the results range from a failed print to a nozzle dragged across the bed at full speed. A web tool cannot know which printer you have, which nozzle is fitted, whether your bed is glass or PEI, or whether your Z offset was set last week. The slicer on your computer knows all of it, because you told it once when you set it up.
There is also a simpler point. The person searching for this genuinely needs a slicer — not for this print, but for every print afterwards. Handing them a G-code file solves one problem and leaves them without the tool they will need tomorrow.
Choosing a slicer: four good options, for different people
All four of these are free, all four produce good prints, and the differences between them are smaller than the arguments about them suggest. Choose on who you are, not on which is best.
PrusaSlicer is the one to pick if you want to understand what you are doing. The settings are organised the way the printing process actually works, the tooltips explain what each one does rather than restating its name, and it has the best documentation of the four. It suits a Prusa obviously, but it has profiles for most common machines and it is a reasonable default for anyone.
OrcaSlicer is a fork of Bambu Studio, which is itself a fork of PrusaSlicer. It suits the person who wants to tune. It has the best calibration tools built in — flow rate, pressure advance, temperature towers — as guided wizards rather than as something you have to build yourself, and it supports a very wide range of printers. If you have a Voron, a Klipper machine, or a printer you have modified, this is usually the one.
Bambu Studio is the answer if you have a Bambu printer, and less compelling if you do not. It is tightly built around that hardware, including the multi-material system, and the defaults are genuinely good. It can drive other printers but there is no reason to prefer it for one.
Cura has the largest number of printer profiles by a wide margin, so if you have something unusual it is the most likely to just work. It is also the one most likely to be assumed in a tutorial you find online. Its settings are organised alphabetically within categories rather than by process, which makes finding things harder than it needs to be once you go past the basics.
If you have no reason to prefer any of them: PrusaSlicer if you want to learn, OrcaSlicer if you want to tune, Cura if your printer is unusual, Bambu Studio if you own a Bambu.
The printer profile, which is the step people skip
When you install a slicer it asks which printer you have. If yours is in the list, pick it, and most of the work is done — that profile carries the bed size, the nozzle diameter, the maximum speeds and accelerations the machine can actually manage, and the start and end sequences that match its firmware.
If yours is not in the list, this is the step that decides how your prints come out, and it is worth half an hour. The values that matter most: bed size in X, Y and Z; nozzle diameter, which is almost always 0.4 mm unless you changed it; filament diameter, which is 1.75 mm for nearly everything; and whether the machine has a heated bed.
The start G-code is the part worth copying rather than writing. Find it in the profile your printer manufacturer publishes, or in the community profile for your machine, and paste it in. Writing your own start sequence is how people end up printing into thin air because the machine never homed.
One thing to check whatever you do: the nozzle diameter in the profile has to match the nozzle actually fitted to the machine. Changing the physical nozzle to 0.6 mm and leaving the profile at 0.4 is a common and confusing failure — the slicer plans paths for a thinner line than the printer produces, and everything comes out over-extruded and blobby.
The settings that actually matter
Layer height is how thick each slice is, and it is the main trade between speed and finish. With a 0.4 mm nozzle, 0.2 mm is the sensible default, 0.28 or 0.3 is fast and visibly stepped, and 0.12 is slow and smooth. The rule to remember is that layer height should not exceed about 75% of the nozzle diameter, because the plastic has to be squashed against the layer below to stick to it.
Infill is how solid the inside is. Most people use far too much. For anything decorative, 10% is plenty. For a functional part that takes load, 25 to 40% with a gyroid or cubic pattern. Above about 50% you are adding print time and weight for very little extra strength — if the part needs to be stronger than that, more perimeters help more than more infill.
Perimeters, or wall loops, do more for strength than infill does. Two is the default and three is a better default for anything functional. A part that has to resist bending gains more from a fourth perimeter than from doubling the infill.
Supports are scaffolding for overhangs. The rule of thumb is that anything overhanging by more than about 45 degrees from vertical needs them. Turn them on only when you need them: they use filament, add time, and leave a rough surface where they touch. Often the better answer is to rotate the model so the overhang goes away.
Temperature comes from the filament, not from the printer. Whatever is printed on the spool is the place to start — usually 200 to 215 for PLA, 230 to 250 for PETG, 240 to 260 for ABS. Bed temperature is typically 60 for PLA, 80 for PETG and ABS. If the spool disagrees with the internet, believe the spool.
The first layer is the one that decides whether the print survives. It is printed slower and hotter on purpose. If it does not stick, the problem is almost always the Z offset — the gap between nozzle and bed — rather than anything in the slicer.
What goes wrong, and what causes it
The print will not stick to the bed. Z offset first, then bed cleanliness. The nozzle should be close enough that the first layer is visibly squashed, not round. Clean the bed with isopropyl alcohol — fingerprints are grease, and grease is why prints let go. A brim helps but it treats the symptom.
Layers split apart. The printer is too cold, or a draught is cooling the print. Raise the nozzle temperature five degrees at a time. With ABS or ASA, an enclosure is not optional.
Strings between parts. Retraction is too low or the nozzle too hot. Try five degrees cooler first, because it costs nothing, then increase retraction distance a little. PETG strings more than PLA and always will.
The print has shifted sideways partway up. Something obstructed the head or a belt slipped. Check the belts are tight and nothing was in the way, including a previously printed part that had curled up.
Overhangs are drooping. More cooling, or supports, or rotate the part. Cooling fans matter more for overhangs than for anything else.
Dimensions are slightly wrong. Holes printing undersized is normal and expected — a circle made of straight segments printed with a round nozzle always comes out a little small. Design in the tolerance, or measure and compensate.
Where 3MF fits, and why it is a better handover than STL
If you are sending a model to someone else to print, or saving your own work to come back to, 3MF is the better file. It records the units, so the part cannot arrive at the wrong size. It keeps several objects apart instead of merging them. And when saved from a slicer as a project, it carries the print settings and the plate arrangement with it.
That last point is the useful one. A 3MF project file from PrusaSlicer or OrcaSlicer holds not just the shape but every decision you made about printing it, so opening it six months later restores the whole setup rather than making you remember what you did.
This site converts STL to 3MF and back, along with most other mesh formats. What it does not do is the slicing step, which is the one that needs your printer.
Where we can actually help
The step before slicing is getting your model into a format your slicer reads, and that part does run here. STL and 3MF are both read by every slicer listed above; 3MF is the better of the two because it records its units and keeps objects apart. The step after slicing runs here too: the G-code viewer shows the print layer by layer before you start it, and the cost calculator turns its weight and time into money.
Questions
- Can I look at a G-code file without opening a slicer?
- Yes. The G-code viewer on this site opens a G-code file from any slicer in your browser and shows every layer, with walls, infill and supports in their own colours, plus the print time and the filament it needs. Nothing is uploaded.
- Is there any way to convert STL to G-code online?
- Some sites offer it, and what they produce is G-code for an assumed printer with assumed settings. If your machine differs from the assumption — different bed size, different nozzle, different start sequence — the result ranges from a failed print to a crash into the bed. Install a slicer instead; all four of the good ones are free and take about ten minutes to set up.
- Which slicer should I install?
- PrusaSlicer if you want to understand the settings, OrcaSlicer if you want calibration tools and support for modified machines, Cura if your printer is unusual and you need the widest profile list, Bambu Studio if you have a Bambu printer. All four are free and all four produce good prints.
- How long does slicing take?
- Usually a few seconds, occasionally a minute for a very large or very detailed model. It is not a slow process. What takes time is setting up the printer profile the first time, and that is done once.
- Can I edit G-code by hand?
- Yes, and it is occasionally useful — inserting a filament change at a particular layer, or adjusting a temperature partway up. It is a plain text file. What you should not do is try to write a whole print by hand, or move code between different printers.
- My printer wants .gcode but my slicer made .gco or .g. Is that a problem?
- No. They are the same thing with different extensions, and some firmware is fussy about which it sees. Rename the file if your printer refuses it.
- Do I need to convert my STL to something else first?
- No. Every slicer reads STL directly. Converting to 3MF first is worth doing if you want the units recorded or the objects kept separate, but it is not required.
Where to go next
Related guides
Tools that do part of this here
About these formats
Checked against current software versions on 2026-09-11