STL and 3MF are model files, while G-code is the set of instructions a printer follows. STL vs 3MF comes down to context: STL stores only a triangle surface, 3MF can also carry multiple materials and project data, and G-code is what your slicer exports for one specific printer.
Mixing them up is why people download a model and cannot print it, or send a file the printer refuses. This explainer is based on Wikipedia, Prusa's documentation and the Marlin G-code index. For a closer look at the instruction file, read what G-code is and how to read it.
What is the difference between STL, 3MF and G-code?
STL and 3MF describe a model, and G-code is the instruction file your slicer produces from it.
- STL: the oldest and most common model file. Shape only. No units, no color, no settings.
- 3MF: a newer model format that can also carry print settings, multiple materials and more. Slicers use it to save projects.
- G-code: the output of the slicer. Your printer reads it line by line. You cannot slice it again.
The usual flow is: design or download an STL or 3MF, open it in a slicer, then export G-code. If you have not picked a slicer yet, read what a slicer is.
STL: the shape and nothing else
STL was created for the stereolithography software of 3D Systems; Wikipedia dates the format to 1987. An STL file describes a raw surface made of triangles, each defined by its corner points and a direction it faces. Two details matter in daily use:
- No scale information. Wikipedia notes that STL files contain no scale information and the units are arbitrary. Slicers usually assume millimeters. If a model imports tiny or huge, the units are the first thing to check.
- No color or texture. STL describes only surface geometry, so it cannot hold color, materials or print settings.
STL files come in ASCII and binary versions; binary is more common because it is more compact. Almost every slicer and model site supports STL, which is why it remains the default for sharing a single part.
3MF: a model plus context
3MF (3D Manufacturing Format) is an open standard published by the 3MF Consortium. Wikipedia describes it as XML-based and designed for additive manufacturing, and says it differs from STL because manufacturing features such as hotend and bed temperatures, feed rate, part regions with multiple materials and support structures can be embedded in the file. The consortium has included CAD and manufacturing companies since 2015, including Autodesk, Dassault Systemes, HP and Microsoft.
In practice, this means a 3MF can hold more than one object, the position of each on the bed and, depending on the slicer, your chosen settings. Slicers use it as a project file. Prusa's Configuration Wizard even has an option to associate 3MF and STL files with PrusaSlicer, and notes that 3MF project files by default do not store the full path to the source models, because that could be a security risk when sharing a file.
Caution. What gets stored in a 3MF depends on the program that wrote it. A 3MF saved by one slicer may open in another with the geometry intact but the settings ignored. Check your slicer's documentation before relying on it to move settings between programs.
G-code: the printer's instructions
G-code is a programming language used to control CNC machines and 3D printers; Wikipedia says it is standardized in ISO 6983-1 and that it has many variants. Each line tells the machine where to move, how fast and what to do next. The Marlin firmware documentation indexes the commands: for example G0 and G1 are linear moves, G28 is auto home, G29 is bed leveling and G90 sets absolute positioning.
A slicer writes thousands of these lines, one set per layer. An illustrative line looks like G1 X50 Y50 F3000: move in a straight line to X 50, Y 50 at a feed rate of 3000. Your slicer sets every number.
Because the file is tied to the settings you chose, G-code is specific to one printer, nozzle, filament and profile. Treat it as a finished product: if you need a change, adjust the settings in the slicer and export again, rather than editing the file by hand.
Binary G-code (bgcode)
Some newer Prusa printers use a binary version. Prusa's open-source libbgcode project describes it as a block-structured format with separate blocks for metadata and G-code, compression for smaller files and a checksum for data validity. PrusaSlicer's first-print guide refers to exporting either G-code or bgcode. Check which one your printer accepts before choosing the export option.
What is inside an STL file, and why does that cause problems?
Wikipedia describes the binary layout precisely: an 80-byte header that software ignores, a 4-byte count of triangles, then 50 bytes per triangle (a normal vector, three vertices, and a 2-byte attribute field that should normally be zero). The ASCII version starts with the word solid and lists each facet as text, which is why ASCII files are far larger for the same model.
Because the file is only a bag of triangles, Wikipedia lists several limits that show up as slicing trouble:
- Curves are approximated. Triangles can only approximate a curved surface, so users often export very large files to reduce the error. A coarse export prints visible facets.
- A valid solid must be closed. Every edge should be shared by exactly two faces. Holes, reversed normals or non-manifold geometry can cause slicing failures or print errors, and automatic repair that merges nearby vertices can give unpredictable results.
- Color is non-standard. Some programs hide color in the attribute bytes or header, but different programs use different conventions, so other software cannot reliably read it.
- Units are not stored. Software usually asks the user, most often millimeters or inches.
If a slicer reports a non-manifold mesh or open edges, the fix is on the model side: repair it in the CAD or mesh program, or use the slicer's repair tool, then export again. What a slicer does explains why a broken mesh stops the slice.
What does 3MF add, and who maintains it?
Wikipedia says 3MF is built on ZIP and XML and the Open Packaging Conventions, so a .3mf file is a package rather than a flat list of triangles. The format was released on 29 April 2015 by the 3MF Consortium. Its founding members include Autodesk, Dassault Systemes, HP and Microsoft, and later members include Materialise, 3D Systems, Siemens and Stratasys. The same page says it became part of a Linux Foundation open standards project in 2022 and an ISO/IEC standard, 25422:2025, in 2025.
The practical gain over STL is that manufacturing information can travel with the model instead of being shared separately: Wikipedia names hotend and bed temperatures, feed rate, multi-material part regions and support structures. Which of these a given slicer actually writes or reads is up to that slicer, so test with your own program before relying on it.
Which format should you export from CAD or download for a given job?
| Situation | Choose | Reason |
|---|---|---|
| Uploading a single part to a model site | STL | Every slicer opens it |
| Round or organic shape you will print large | STL at a fine export tolerance, or 3MF | A coarse triangle export shows facets |
| Multi-color or multi-material model | 3MF | STL has no standard place for material regions |
| Handing a project to someone using the same slicer | 3MF project | Keeps the plate layout and, in that slicer, its settings |
| Printing a job | G-code or bgcode | The printer cannot read model files |
Comparison table
| STL | 3MF | G-code | |
|---|---|---|---|
| Contains | Triangle surface only | Model data plus optional manufacturing features | Machine instructions |
| Color and materials | No | Yes, per the 3MF standard | Only as commands |
| Units | Arbitrary, not stored | Check the size after import | Set by commands (for example G21 for millimeters) |
| Opened by | Slicers, CAD, viewers | Slicers and CAD | Printers, G-code viewers |
| Editable in a slicer | Yes, as a model | Yes, as a model or project | No |
G21 appears in the Marlin G-code index as the millimeter-units command.
Which file should you use?
Use STL to share a single part, 3MF to save slicer projects or multi-material work, and G-code (or bgcode) to send a job to the printer.
- Sharing or downloading a single part: STL is the safest choice for compatibility.
- Saving your work in a slicer: use the slicer's project format, often 3MF, so you do not lose object placement.
- Multi-color or multi-material models: choose 3MF, since STL cannot hold the information.
- Sending to the printer: export G-code (or bgcode, if your printer needs it) from the slicer.
Common mistakes
- Trying to open G-code in a slicer to edit the model. It holds toolpaths, not a model. Go back to the STL or 3MF.
- Printing at the wrong size. Unit confusion in STL files is common. Check the dimensions after import.
- Reusing G-code on a different printer. It was sliced for one machine. Re-slice with the right profile.
- Expecting settings to travel inside every 3MF. It depends on the program.
If your model comes from your own design, see designing your first print in Tinkercad for how to export. Once a print starts, how to 3D print covers the rest of the process.
This page is research from the sources listed, not from print tests.
Cura opens STL and 3MF files and outputs G-code; see Cura for beginners for how.
Related: How to send a print to your printer.
Creating your own file? See how to make a 3D print model and which format to export.




