Hubbry Logo
STL (file format)STL (file format)Main
Open search
STL (file format)
Community hub
STL (file format)
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
STL (file format)
STL (file format)
from Wikipedia
STL
A CAD representation of a torus (shown as two concentric red circles) and an STL approximation of the same shape (composed of triangular planes)
Filename extension
.stl
Internet media type
  • model/stl[1][2]
  • model/x.stl-ascii
  • model/x.stl-binary
Developed by3D Systems
Initial release1987
Type of formatStereolithography

STL is a file format native to the stereolithography CAD software created by 3D Systems.[3][4][5] Chuck Hull, the inventor of stereolithography and 3D Systems’ founder, reports that the file extension is an abbreviation for stereolithography,[6] although it is also referred to as standard triangle language or standard tessellation language.[2]

An STL file describes a raw, unstructured triangulated surface by the unit normal and vertices (ordered by the right-hand rule[2]) of the triangles using a three-dimensional Cartesian coordinate system.[7] In the original specification, all STL coordinates were required to be positive numbers, but this restriction is no longer enforced and negative coordinates are commonly encountered in STL files today. STL files contain no scale information, and the units are arbitrary.[8] STL files describe only the surface geometry of a three-dimensional object without any representation of color, texture or other common CAD model attributes. The STL format specifies both ASCII and binary representations. Binary files are more common, since they are more compact.[9]

STL is widely used for rapid prototyping, 3D printing and computer-aided manufacturing,[10] and supported by many other software packages.[citation needed]

History

[edit]

STL was invented by the Albert Consulting Group for 3D Systems in 1987.[11] The format was developed for 3D Systems' first commercial 3D printers. Since its initial release, the format remained relatively unchanged for 22 years.[12]

In 2009, an update to the format dubbed STL 2.0 was proposed, which evolved into the Additive manufacturing file format.[12][13]

Format

[edit]

ASCII

[edit]

An ASCII STL file begins with the line:

solid name

where name is an optional string (though if name is omitted there must still be a space after solid, for compatibility with some software). The remainder of the line is ignored and is sometimes used to store metadata (e.g., filename, author, modification date, etc).[14] The file continues with any number of triangles, each represented as follows:[15]

facet normal ni nj nk
    outer loop
        vertex v1x v1y v1z
        vertex v2x v2y v2z
        vertex v3x v3y v3z
    endloop
endfacet

where each n or v is a floating-point number in sign-mantissa-e-sign-exponent format, e.g., 2.648000e-002. The file concludes with:

endsolid name
An example ASCII STL of a sphericon

The structure of the format suggests that other possibilities exist (e.g., facets with more than one loop, or loops with more than three vertices), although the file format description refers only to triangle tessellations.[2]

Whitespace (spaces, tabs, newlines) may be used anywhere in the file except within numbers or words. The spaces between facet and normal and between outer and loop are required.[9]

Binary

[edit]

Because ASCII STL files can be large, a binary version of STL exists. A binary STL file has an 80-character header that is generally ignored, but should never begin with the ASCII representation of the string solid, as that may lead some software to confuse it with an ASCII STL file. Following the header is a 4-byte little-endian unsigned integer indicating the number of triangular facets in the file. Following that is data describing each triangle in turn. The file simply ends after the last triangle.

Each triangle is described by 12 32-bit floating-point numbers: 3 for the normal and then 3 for the X/Y/Z coordinate of each vertex – just as with the ASCII version of STL. After these follows a 2-byte ("short") unsigned integer that is the "attribute byte count" – in the standard format, this should be zero because most software does not understand anything else.[9]

Floating-point numbers are represented as IEEE floating-point numbers and are assumed to be little-endian, although this is not stated in documentation.

UINT8[80]    – Header                 - 80 bytes
UINT32       – Number of triangles    - 04 bytes
foreach triangle                      - 50 bytes
    REAL32[3] – Normal vector         - 12 bytes
    REAL32[3] – Vertex 1              - 12 bytes
    REAL32[3] – Vertex 2              - 12 bytes
    REAL32[3] – Vertex 3              - 12 bytes
    UINT16    – Attribute byte count  - 02 bytes
end

There are at least two non-standard variations on the binary STL format for adding color information:

  • The VisCAM and SolidView software packages use the two "attribute byte count" bytes at the end of every triangle to store a 15-bit RGB color:
    • bits 0–4 are the intensity level for blue (0–31),
    • bits 5–9 are the intensity level for green (0–31),
    • bits 10–14 are the intensity level for red (0–31),
    • bit 15 is 1 if the color is valid, or 0 if the color is not valid (as with normal STL files).
  • The Materialise Magics software uses the 80-byte header at the top of the file to represent the overall color of the entire part. If color is used, then somewhere in the header should be the ASCII string COLOR= followed by four bytes representing red, green, blue and alpha channel (transparency) in the range 0–255. This is the color of the entire object, unless overridden at each facet. Magics also recognizes a material description; a more detailed surface characteristic. Just after COLOR=RGBA specification should be another ASCII string ,MATERIAL= followed by three colors (3×4 bytes): first is a color of diffuse reflection, second is a color of specular highlight, and third is an ambient light. Material settings are preferred over color. The per-facet color is represented in the two "attribute byte count" bytes as follows:
    • bits 0–4 are the intensity level for red (0–31),
    • bits 5–9 are the intensity level for green (0–31),
    • bits 10–14 are the intensity level for blue (0–31),
    • bit 15 is 0 if this facet has its own unique color, or 1 if the per-object color is to be used.

The red/green/blue ordering within those two bytes is reversed in these two approaches – so while these formats could easily have been compatible, the reversal of the order of the colors means that they are not – and worse still, a generic STL file reader cannot automatically distinguish between them. There is also no way to have facets be selectively transparent because there is no per-facet alpha value – although in the context of current rapid prototyping machinery, this is not important.

Facet normal

[edit]

In both ASCII and binary versions of STL, the facet normal should be a unit vector pointing outward from the solid object.[16] In most software this may be set to (0,0,0), and the software automatically calculates a normal based on the order of the triangle vertices using the "right-hand rule", i.e. the vertices are listed in counter-clock-wise order from outside.[2] Some STL loaders (e.g. the STL plugin for Art of Illusion) check that the normal in the file agrees with the normal they calculate using the right-hand rule and warn the user when it does not. Other software may ignore the facet normal entirely and use only the right-hand rule. Although it is rare to specify a normal that cannot be calculated using the right-hand rule, in order to be entirely portable, a file should both provide the facet normal and order the vertices appropriately. A notable exception is SolidWorks, which uses the normal for shading effects.

Characteristics

[edit]

It is not possible to use triangles to perfectly represent curved surfaces. To compensate, users often save enormous STL files to reduce the inaccuracy. However, native formats associated with many 3D design applications use mathematical surfaces to preserve detail losslessly in small files. For example, Rhino 3D[17] and Blender[18] implement NURBS to create true curved surfaces and store them in their respective native file formats, but must generate a triangle mesh when exporting a model to the STL format.

3D printing

[edit]
Wikipedia logo

3D printers build objects by solidifying (SLA, SLS, SHS, DMLS, EBM, DLP) or printing (3DP, MJM, FDM, FFF, PJP, MJS)[19] one layer at a time. This requires a series of closed 2D contours (horizontal layers) that are filled in with solidified material as the layers are fused together. A natural file format for such a machine would be a series of closed polygons (layers or slices) corresponding to different Z-values. However, since it is possible to vary the layer thicknesses for a faster though less precise build, it was easier to define the model to be built as a closed polyhedron that can be sliced at the necessary horizontal levels. An incorrect facet normal can affect the way a file is sliced and filled. A slice at a different Z-value can be chosen to miss a bad facet or the file must be returned to CAD program to make corrections and then regenerate the STL file.

To properly form a 3D volume, the surface represented by any STL files must be closed (no holes or reversed vector normal) and connected, where every edge is shared by exactly two faces, and not self-intersecting. Since the STL syntax does not enforce this property, it can be ignored for applications where the void does not matter. The missing surface matters insofar as the software that slices the triangles requires it to ensure that the resulting 2D polygons are closed. Sometimes such software can be written to clean up small discrepancies by moving vertices that are close together so that they coincide. The results are not predictable, and may require repair using another program. Vector 3D printers require a clean STL file and printing a bad data file either fails to fill or may stop printing.

Other fields

[edit]
STL model of the Utah teapot

STL is simple and easy to output. Consequently, many computer-aided design systems can output the STL file format. Although the output is simple to produce, mesh connectivity information is discarded because the identity of shared vertices is lost.

Many computer-aided manufacturing systems require triangulated models. STL format is not the most memory- and computationally efficient method for transferring this data, but STL is often used to import the triangulated geometry into the CAM system. The format is commonly available, so the CAM system can use it. In order to use the data, the CAM system may have to reconstruct the connectivity. As STL files do not save the physical dimension of a unit, a CAM system asks for it. Typical units are mm and inch.

STL can also be used for interchanging data between CAD/CAM systems and computational environments such as Mathematica.

See also

[edit]
  • 3D Manufacturing Format – Open source file format standard
  • Additive Manufacturing File Format – Open standard for describing objects for additive manufacturing processes such as 3D printing
  • PLY (file format) – File format designed to store three-dimensional data from 3D scanners
  • Voxel – Element representing a value on a grid in three dimensional space
  • Wavefront .obj file – Geometry definition file format
  • X3D – XML-based file format for 3D computer graphics

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
The STL (STereoLithography) file format is an openly documented standard for representing the surface geometry of three-dimensional objects as a raw, unstructured triangulated mesh composed of contiguous triangular facets, serving as a interchange format primarily for , , and . Developed by Charles Hull of , Inc. and first documented in the company's StereoLithography Interface Specification in , the format emerged alongside the invention of to enable the translation of CAD data into physical prototypes via additive manufacturing processes. Widely adopted throughout the , STL became the dominant export option in CAD software due to its simplicity and broad compatibility with 3D printers, scanners, and modeling tools such as and . The format exists in two primary variants: an ASCII version, which uses plain-text records structured with keywords like "," "facet," "normal," "outer loop," and "vertex" to define each triangle's outward-facing unit normal vector and three vertex coordinates in Cartesian , and a more compact binary version consisting of an 80-byte header, a 4-byte unsigned indicating the number of facets, and 50 bytes per facet (including 12 bytes for the normal, 36 bytes for vertices, and a 2-byte attribute field typically set to zero). In both, facets must adhere to the for orientation—vertices listed counterclockwise when viewed from outside the model—and share edges with adjacent triangles to form a watertight manifold surface, though the format lacks built-in validation for such properties. Key characteristics include its focus solely on geometric data without support for color, texture, properties, metadata beyond an optional object name, or hierarchical structures like assemblies, resulting in redundant vertex storage and potential inaccuracies for curved or highly detailed surfaces due to approximations. While binary files are preferred for efficiency—reducing size and processing time compared to ASCII—the format's limitations have prompted extensions for color (e.g., via attribute bytes) and ongoing discussions in fields like and about transitioning to more robust alternatives, yet STL remains ubiquitous owing to its patent-free status and ease of implementation.

History

Origins and Invention

The STL file format was developed in 1987 by Charles (Chuck) Hull of , specifically for (SLA) printers. This development aimed to provide a straightforward method for representing 3D models as triangulated surfaces, enabling the layer-by-layer fabrication process central to SLA technology. The format's name derives from "," the pioneering commercial process invented by Hull and first commercialized by in 1987 with the SLA-1 printer. The initial formal documentation of the STL format appeared in the 1988 StereoLithography Interface Specification published by . This specification outlined the format's core purpose for applications, omitting details such as model scale, units of measurement, or additional metadata. As a result, STL focused solely on tessellating 3D surfaces into triangles, facilitating efficient slicing for additive manufacturing without imposing proprietary constraints. During the , the STL format saw widespread early adoption as the for in and early additive manufacturing workflows. Its integration into CAD software, including support for export in tools like , and compatibility with emerging 3D printers accelerated its use across industries, driven by the format's inherent simplicity and absence of licensing fees. This accessibility helped establish STL as a foundational element in the burgeoning field of digital fabrication by the decade's end.

Evolution and Proposed Extensions

The STL file format remained largely unchanged for over two decades following its invention, owing to its deep entrenchment in the ecosystem and the imperative for with established hardware and software infrastructures. In , the ASTM Committee F42 on Additive Manufacturing Technology considered a proposal for STL 2.0, which sought to enhance by incorporating support for color, texture, and metadata to better accommodate evolving additive manufacturing needs. This effort, however, was abandoned in favor of the (AMF), a more robust alternative developed through ASTM collaboration. Although no official revisions materialized, certain CAD tools implemented minor non-standard extensions to the binary STL variant, such as appending color information to facet definitions or headers—for instance, the VisCAM and SolidView packages use the 2-byte attribute field of each facet to encode RGB values. These proprietary additions lack universal standardization, resulting in inconsistent support across software. The AMF was formally released in 2011 as ASTM F42's designated successor to STL, directly addressing the original format's inadequacies in representing multi-material compositions and geometries.

File Format Specification

ASCII Variant

The ASCII variant of the STL file format is a human-readable, text-based representation of 3D surface as a collection of triangular facets, designed primarily for and verification purposes due to its verbosity and larger file sizes compared to the binary variant. The file structure is strictly line-oriented, with each line beginning with a keyword followed by associated data, and the entire content enclosed by header and footer lines that delimit the solid object. Keywords are case-insensitive, allowing flexibility in implementation, while whitespace between elements is tolerant but must preserve the logical sequence of records. The file commences with a "" keyword, optionally followed by a name for the object (typically a short descriptive string with no enforced length limit, though practical implementations keep it concise). This header line is followed by one or more facet definitions, each representing a on the object's surface. The file concludes with an "endsolid" keyword, mirroring the optional name from the header to ensure structural integrity. For the format to represent a valid 3D model, the collection of facets must form a closed, watertight manifold without gaps, overlaps, or degenerate triangles, though enforcement relies on exporting software and validation tools. Each facet is defined within a block starting with "facet normal ni nj nk", where ni, nj, nk are the three floating-point components of the unit-length normal vector pointing outward from the triangle's surface (computed via the right-hand rule from vertex ordering). This is immediately followed by "outer loop", which introduces the three vertices of the triangle, each specified on a separate line as "vertex xi yi zi" with floating-point coordinates in Cartesian space. The block closes with "endloop" to terminate the vertex list and "endfacet" to end the facet definition. Vertices are typically shared among adjacent facets to minimize redundancy, and the normal vector, while required in the syntax, can sometimes be omitted or auto-computed by parsers if inconsistent with the vertices. A representative example of an ASCII STL file for a simple tetrahedral model (a pyramid with base vertices at (0,0,0), (1,0,0), (0,1,0) and apex at (0,0,1), using outward-pointing unit normals) illustrates the exact keyword sequence and structure:

solid tetrahedron facet normal 0.000000 0.000000 -1.000000 outer loop vertex 0.000000 0.000000 0.000000 vertex 0.000000 1.000000 0.000000 vertex 1.000000 0.000000 0.000000 endloop endfacet facet normal 0.000000 -1.000000 0.000000 outer loop vertex 0.000000 0.000000 0.000000 vertex 1.000000 0.000000 0.000000 vertex 0.000000 0.000000 1.000000 endloop endfacet facet normal -1.000000 0.000000 0.000000 outer loop vertex 0.000000 0.000000 0.000000 vertex 0.000000 0.000000 1.000000 vertex 0.000000 1.000000 0.000000 endloop endfacet facet normal 0.577350 0.577350 0.577350 outer loop vertex 1.000000 0.000000 0.000000 vertex 0.000000 1.000000 0.000000 vertex 0.000000 0.000000 1.000000 endloop endfacet endsolid tetrahedron

solid tetrahedron facet normal 0.000000 0.000000 -1.000000 outer loop vertex 0.000000 0.000000 0.000000 vertex 0.000000 1.000000 0.000000 vertex 1.000000 0.000000 0.000000 endloop endfacet facet normal 0.000000 -1.000000 0.000000 outer loop vertex 0.000000 0.000000 0.000000 vertex 1.000000 0.000000 0.000000 vertex 0.000000 0.000000 1.000000 endloop endfacet facet normal -1.000000 0.000000 0.000000 outer loop vertex 0.000000 0.000000 0.000000 vertex 0.000000 0.000000 1.000000 vertex 0.000000 1.000000 0.000000 endloop endfacet facet normal 0.577350 0.577350 0.577350 outer loop vertex 1.000000 0.000000 0.000000 vertex 0.000000 1.000000 0.000000 vertex 0.000000 0.000000 1.000000 endloop endfacet endsolid tetrahedron

This example demonstrates four facets for the , with floating-point precision shown to six decimal places for clarity, though varying precision is acceptable as long as coordinates are consistent. Parsing an ASCII STL file involves sequentially reading lines, matching keywords (ignoring case and extra whitespace), extracting numeric values, and reconstructing the ; invalid structures, such as mismatched keywords or non-unit normals, may render the file unusable without repair.

Binary Variant

The binary variant of the STL file format provides a compact, machine-readable representation of 3D surface geometry, encoding the same triangular facet data as the ASCII variant but in a fixed-length binary structure that significantly reduces file size—typically by 80-90% for complex models—while sacrificing human readability. This format begins with an 80-byte header consisting of unsigned char values, which is often left unused or populated with a descriptive ASCII string such as "STL from CAD software" for identification purposes, though it carries no formal semantic meaning in the specification. Immediately following the header is a 4-byte unsigned long integer (32-bit) in little-endian byte order, specifying the total number of triangles in the file. Each triangle in the binary STL is represented by a fixed 50-byte record, ensuring efficient parsing without variable-length parsing overhead. The record starts with 12 bytes for the unit normal vector of the facet, comprising three 32-bit IEEE 754 floating-point values (4 bytes each) for the x, y, and z components. This is followed by 36 bytes for the three vertices defining the triangle, with each vertex encoded as another set of three 32-bit floats for its x, y, and z coordinates (9 floats total). The record concludes with a 2-byte unsigned short integer indicating the attribute byte count, which is typically set to 0 in standard files but can specify additional bytes (up to 65535) for extensions such as color information in certain implementations. The entire file adheres to little-endian byte order as the de facto standard, facilitating consistent interpretation across platforms. The total file size for a binary STL can be precisely calculated as 84 bytes for the header and triangle count, plus 50 bytes multiplied by the number of , yielding a deterministic ideal for direct memory mapping or streaming in software applications. For illustration, consider a simple binary layout for a single where the normal vector is (0.0, 0.0, 1.0), vertices are at (0.0, 0.0, 0.0), (1.0, 0.0, 0.0), and (0.5, 1.0, 0.0), and attribute count is 0. In little-endian format, this would occupy bytes 84-133 of the file (after header and count), with offsets as follows:
Byte OffsetDescriptionValue (Hex)Float Representation
84-87Normal X00 00 00 000.0
88-91Normal Y00 00 00 000.0
92-95Normal Z00 00 80 3F1.0
96-99Vertex 1 X00 00 00 000.0
100-103Vertex 1 Y00 00 00 000.0
104-107Vertex 1 Z00 00 00 000.0
108-111Vertex 2 X00 00 80 3F1.0
112-115Vertex 2 Y00 00 00 000.0
116-119Vertex 2 Z00 00 00 000.0
120-123Vertex 3 X00 00 00 3F0.5
124-127Vertex 3 Y00 00 80 3F1.0
128-131Vertex 3 Z00 00 00 000.0
132-133Attribute Byte Count00 000
This example demonstrates the sequential, packed nature of the binary encoding, where each 32-bit float is stored in little-endian order (least significant byte first).

Facet and Normal Definition

In the STL file format, the surface of a 3D object is approximated by a collection of triangular facets, each representing a discrete portion of the geometry. Each facet is defined by three vertices specified in Cartesian coordinates (x, y, z), encoded as 32-bit floating-point numbers, which collectively form a triangulated mesh that tessellates the object's boundary. This triangular representation enables a piecewise linear approximation of potentially curved surfaces, with the density of facets determining the level of detail and smoothness. Associated with each facet is a normal vector, a unit vector (ni, nj, nk) with components also stored as 32-bit floating-point numbers, that indicates the outward orientation of the triangle relative to the object's interior. This normal is essential for distinguishing the inside from the outside in watertight models, facilitating processes such as slicing for additive manufacturing by ensuring consistent surface directionality. The vector follows the , where the vertices are ordered counterclockwise when viewed from the exterior, aligning the normal perpendicularly outward from the facet plane. For the mesh to represent a valid, manifold (closed) surface, the triangles must be oriented consistently with non-overlapping interiors, sharing exactly two vertices with each adjacent facet to form connected edges without gaps or intersections. STL provides no native support for edges, curves, or higher-order parametric geometries such as NURBS, relying solely on this explicit for all surface descriptions. Although vector is explicitly included in the format, it can be derived computationally as the normalized of two edges formed by the facet's vertices (e.g., v1=P2P1\vec{v_1} = P_2 - P_1
Add your contribution
Related Hubs
User Avatar
No comments yet.