Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:STL

From ReverseEngineering.wiki
Format
Magic none (ASCII starts with "solid")
Extensions .stl
On this wiki Facts · Code · Notes · Topics

Stereolithography triangle mesh (.stl) in ASCII ("solid") and binary form: an 80-byte header, a u32 facet count and 50-byte facets. A leading "solid" does not prove ASCII.

Identification

Assimp's importer (code/AssetLib/STL/STLLoader.cpp) documents a binary STL as: an 80-byte header, a 4-byte face count, then 50 bytes per face (lines 73-76). Its binary test (IsBinarySTL, lines 77-90) is: file size at least 84 and faceCount * 50 + 84 == file size, where the count is the little-endian u32 at offset 80.

A binary header may itself begin with the text solid NAME; the source comments that the "solid NAME" check is necessary but not sufficient (lines 95-97), and that many exporters write solid into binary files (line ~112). So test the size equation first. Assimp's ASCII test (IsAsciiSTL, lines 98-125) returns false when the size equation holds, otherwise requires the text to start with solid (after spaces) and, for files of at least 500 bytes, no byte above 127 in the first 500 bytes.

Binary layout

Per facet 50 bytes: normal (3 float32), three vertices (3 x 3 float32), then a 2-byte attribute field (12 + 36 + 2). Assimp reads the attribute as little-endian and, when bit 15 is set, takes it as a colour of 5 bits per channel (lines 494-525): bits 0-4, 5-9, 10-14. By default bits 0-4 are blue and bits 10-14 red; if the 80-byte header contains the text COLOR= followed by 4 bytes (RGBA default colour), the importer takes a "Materialise" path where the order is reversed (red in bits 0-4) (lines 434-451, 515-523). Colour conventions differ between tools.

ASCII layout

The ASCII importer looks for the keywords solid, facet (followed by normal), vertex (lines 241-320).

Tools and sources

assimp (BSD-3-Clause): https://github.com/assimp/assimp

Code & repositories

  • https://github.com/assimp/assimp @ f20e46b3fc1fdf9bc2675fd549d180dda06861f1 · license: BSD-3-Clause (declared by the contributor for the files used; GitHub reports BSD-3-Clause (read from LICENSE; GitHub's detector did not classify it) for the repository)
    Open Asset Import Library; importers in code/AssetLib read as format documentation
    Tested on: source read, not run: source read only · checked 2026-10-19; last activity 2026-10-17; Note: the latest release ships binaries; the wiki links only the source, never the binaries

See also

Format:PLY, Format:Wavefront OBJ, Format:3MF