STL Basics ⏱ 6 min read

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.

// Key Insight

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.

// Gotcha

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 CountASCII Size (approx)Binary Size (approx)Ratio
1,000~280 KB~49 KB5.7×
10,000~2.8 MB~488 KB5.7×
100,000~28 MB~4.8 MB5.8×
1,000,000~280 MB~47.7 MB5.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

SituationRecommended FormatReason
Sending to a print service or slicerBinarySmaller, faster to upload and process
Debugging geometry issuesASCIIOpen in a text editor to inspect exact coordinates
Writing an STL parser or generatorASCII firstEasier to validate output during development
Archiving or publishing a modelBinaryStorage efficiency, universal compatibility
Sharing with old hardware (pre-2000)ASCIISome 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
// Pro Tip

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

Do binary and ASCII STL produce the same printed result?
Yes, always. The format affects only how the data is encoded on disk. Both formats represent the exact same triangle geometry, and slicers produce identical G-code from both.
Why does my slicer sometimes reject an STL file?
Usually because the file has errors in the geometry — non-manifold edges, holes, or inverted normals — not because of the ASCII vs binary encoding. Use MeshLab or Meshmixer to repair the mesh before importing.
Can a single STL file be partly ASCII and partly binary?
No. An STL file is either entirely ASCII or entirely binary. Mixed-format STL does not exist as a standard.
Does the 80-byte binary header contain useful information?
Sometimes. Some software writes metadata like the exporting application name, date, or model scale. But there is no standard for what goes there, so the content is often arbitrary or empty.

Related Articles

← Back to Knowledge Hub