Introduction
STL was created by 3D Systems in 1987 for its stereolithography printers, and it is still the most common format for 3D printing. An STL file holds one thing: a surface made of triangles. It has no colours, materials or units, so a model in millimetres and one in inches look the same to the file.
There are two forms with the same extension and the same content. ASCII STL is readable text; binary STL is smaller and far more common.
Variations
| Format | Variation | About | Open |
|---|---|---|---|
.STL | ASCII STL | The text form of STL: each triangle a facet of three vertex lines. | Open |
.STL | Binary STL | The usual form of STL: a header, a count, then 50 bytes per triangle. | Open |
ASCII STL
The text form: each triangle is written out with the keywords facet,
outer loop and vertex. It is easy to read and to write by
hand, but several times larger than the binary form.
The file starts with the word solid and ends with
endsolid. Because some binary files also begin their header with
solid, a reader should check further: an ASCII file has
facet lines after the first line, and its size does not match the
binary formula below.
Reference: Grammar.
Binary STL
The compact form: an 80-byte header, a count of triangles, then 50 bytes per triangle. Slicers and CAD programs write this form by default.
The file size is exactly 84 + 50 × count, where the count is the
32-bit little-endian number at offset 80.
Reference: File layout and Colour extensions.
Not described
These pages follow 3D Systems’ original description as reprinted, and the common practice of later tools. The explorer reads both forms.
Known, not yet covered
- Viewer: the explorer tells the two forms apart by the size (84 + 50 × count) and shows binary STL
as the header (with the Materialise Magics COLOR= and MATERIAL= when present), the count, every 50-byte triangle
(normal, three vertices, attribute) and any bytes after them, and ASCII STL as every solid with every facet and its
grammar parts (the words are read with any white space between them; keywords in capitals, tabs, CR LF, nan and inf
are read and noted). The Facets table lists every triangle in pages with notes for a zero normal, a normal that
disagrees with the vertex order, a degenerate triangle and a coordinate that is not finite. The Overview gives the
bounding box, surface area, signed volume and the vertex-to-vertex rule (matching every edge: gaps, edges shared by
more than two facets, facets running the same way), and the 3D view draws the triangles (a regular sample above
1,000,000; every triangle stays in the table), picks a triangle to its bytes, and colours it from the attribute bytes
by the scheme chosen in the options bar (VisCAM and SolidView, Materialise Magics, or none; the two cannot be told apart
from the facet bytes). Checked against real files from three.js and numpy-stl (every number of the ASCII files against
an independent reader, every record of the binary ones) and built files for every rule. Not covered: the edge matching
is done only up to 400,000 facets (the Overview says so above that); a binary file whose header
starts with
solidand whose size does not fit is read as binary only when its first triangle holds sane numbers; and no program that writes STL was run to compare its output.
Unknown
- Reference: the rule for the 80-byte header’s content in the original specification, whose syntax the reprint shows only as an image.
- Reference: the “special attributes for building parameters”, which were never specified.
Links
Software
- PrusaSlicer – Prusa Research’s free open source slicer (Windows, macOS, Linux)
- UltiMaker Cura – free open source slicer from UltiMaker (Windows, macOS, Linux)
- Bambu Studio – Bambu Lab’s free slicer for its printers (Windows, macOS, Linux)
- OrcaSlicer – free open source slicer for many printer brands (Windows, macOS, Linux)
- Blender – free open source 3D suite that imports and exports STL (Windows, macOS, Linux)
- MeshLab – free open source mesh viewer and editor, useful for repairing STL (Windows, macOS, Linux)
- FreeCAD – free open source parametric CAD program (Windows, macOS, Linux)
- Autodesk Fusion – Autodesk’s CAD and CAM program (Windows, macOS)
Developers
Reference
- The StL Format – Marshall Burns’ account of 3D Systems’ 1989 specification, from Automated Fabrication
- STL (STereoLithography) File Format Family – the Library of Congress’s description of the family