Binary vs ASCII STL — What's the Difference?
The STL format exists in two completely different encodings — ASCII and Binary — that produce identical geometry but wildly different file sizes. Understanding the difference matters when sharing models, debugging slicer errors, and optimising storage. Most software handles both transparently, but knowing which you are working with explains a lot.
The Two STL Formats
When Chuck Hull designed STL in 1987, he specified two ways to encode the triangle data: a human-readable text format (ASCII) and a compact binary format. Both describe exactly the same geometry. The choice between them affects only file size, readability, and software compatibility — never the shape of the printed object.
Binary STL files are typically 5 to 6 times smaller than ASCII STL files for the same model. A 60MB ASCII STL becomes approximately 10MB in binary encoding.
ASCII STL — Structure and Example
ASCII STL files are plain text. Every value is written out as a human-readable number. The file always begins with the keyword solid followed by an optional name, and ends with endsolid.
Here is a minimal ASCII STL file representing a single triangle:
solid MyModel
facet normal 0.577350 0.577350 0.577350
outer loop
vertex 0.000000 0.000000 0.000000
vertex 1.000000 0.000000 0.000000
vertex 0.000000 1.000000 0.000000
endloop
endfacet
endsolid MyModel
Each facet block represents one triangle. The normal is a unit vector pointing outward from the surface. The three vertex lines give the X, Y, Z coordinates of each corner. A typical 3D-printed model with 100,000 triangles would have 100,000 facet blocks — which is why ASCII files get very large.
Binary STL — Structure and Example
Binary STL compresses the same data into a fixed-length binary record for each triangle. The file structure is:
- 80-byte header — free-form text (often contains software name or model info, but sometimes deliberately left blank)
- 4-byte unsigned integer — number of triangles in the file
- 50 bytes per triangle — 12 bytes for normal (3 × 4-byte float), 36 bytes for vertices (3 × 3 × 4-byte float), 2 bytes attribute byte count (usually 0)
Total file size formula: 80 + 4 + (50 × number_of_triangles) bytes.
For 100,000 triangles: 80 + 4 + (50 × 100,000) = 5,000,084 bytes ≈ 4.77 MB. The equivalent ASCII file would be 25–30 MB.
Some older software writes ASCII text into the 80-byte binary header — and some STL readers try to detect format by checking if the header starts with the word "solid". This causes false detections. The reliable detection method is checking byte 80 for the triangle count, not reading the header text.
File Size Comparison
| Triangle Count | ASCII Size (approx) | Binary Size (approx) | Ratio |
|---|---|---|---|
| 1,000 | ~280 KB | ~49 KB | 5.7× |
| 10,000 | ~2.8 MB | ~488 KB | 5.7× |
| 100,000 | ~28 MB | ~4.8 MB | 5.8× |
| 1,000,000 | ~280 MB | ~47.7 MB | 5.9× |
How to Tell Which Format You Have
Most 3D software detects the format automatically, but if you need to check manually:
- Open in a text editor — if you see readable text like
solid,facet normal,vertex, it is ASCII. If you see binary garbage characters, it is binary. - Check file size — if the file size matches
84 + (50 × N)bytes where N is a whole number, it is almost certainly binary. - Use MeshLab — free tool that displays format information when you import a file.
When to Use Which
| Situation | Recommended Format | Reason |
|---|---|---|
| Sending to a print service or slicer | Binary | Smaller, faster to upload and process |
| Debugging geometry issues | ASCII | Open in a text editor to inspect exact coordinates |
| Writing an STL parser or generator | ASCII first | Easier to validate output during development |
| Archiving or publishing a model | Binary | Storage efficiency, universal compatibility |
| Sharing with old hardware (pre-2000) | ASCII | Some legacy firmware only accepts ASCII STL |
Converting Between the Two
Almost any 3D tool can convert between ASCII and binary STL without changing the geometry:
- Blender — Import your STL, then re-export with the "ASCII" checkbox toggled on or off
- MeshLab — File → Export Mesh As → STL → choose binary or ASCII in the dialog
- PrusaSlicer — Import STL, then File → Export → Export plate as STL (binary)
- Command line (admesh) —
admesh --write-ascii-stl output.stl input.stl
If you are building a web tool that processes STL files, always implement binary support first. Binary files are what users actually upload 95% of the time. ASCII is rare in practice outside of debugging workflows.
Frequently Asked Questions
Related Articles