Standard Data Format of STL

Reprinted from Reprinted from Section 6.5 of Automated Fabrication by Marshall Burns, Ph.D. Technical source: StereoLithography Interface Specification, 3D Systems, Inc., October 1989

An STL (“StereoLithography”) file is a triangular representation of a 3-dimensional surface geometry. The surface is tessellated or broken down logically into a series of small triangles (facets). Each facet is described by a perpendicular direction and three points representing the vertices (corners) of the triangle. These data are used by a slicing algorithm to determine the cross sections of the 3-dimensional shape to be built by the fabber.

Format Specifications

An STL file consists of a list of facet data. Each facet is uniquely identified by a unit normal (a line perpendicular to the triangle and with a length of 1.0) and by three vertices (corners). The normal and each vertex are specified by three coordinates each, so there is a total of 12 numbers stored for each facet.

Facet orientation. The facets define the surface of a 3-dimensional object. As such, each facet is part of the boundary between the interior and the exterior of the object. The orientation of the facets (which way is “out” and which way is “in”) is specified redundantly in two ways which must be consistent. First, the direction of the normal is outward. Second, the vertices are listed in counterclockwise order when looking at the object from the outside (right-hand rule). These rules are illustrated in Figure 1.


Figure 1. Orientation of a facet is determined by the direction of the unit normal and the order in which the vertices are listed.

Vertex-to-vertex rule. Each triangle must share two vertices with each of its adjacent triangles. In other words, a vertex of one triangle cannot lie on the side of another. This is illustrated in Figure 2.


Figure 2. The vertex-to-vertex rule. The left figure shows a violation of the rule. A correct configuration is shown on the right.

The object represented must be located in the all-positive octant. In other words, all vertex coordinates must be positive-definite (nonnegative and nonzero) numbers. The STL file does not contain any scale information; the coordinates are in arbitrary units.

The official 3D Systems STL specification document states that there is a provision for inclusion of “special attributes for building parameters,” but does not give the format for including such attributes. Also, the document specifies data for the “minimum length of triangle side” and “maximum triangle size,” but these numbers are of dubious meaning.

Sorting the triangles in ascending z-value order is recommended, but not required, in order to optimize performance of the slice program.

The STL standard includes two data formats, ASCII and binary. We will introduce ASCII formart only.


The ASCII format is primarily intended for testing new CAD interfaces. The large size of its files makes it impractical for general use. The syntax for an ASCII STL file is as follows:

solid name
% facet syntax loop
endsolid name

The syntax for facet unit is:

% facet unit syntax
facet normal ni nj nk
    outer loop
        vertex v1x v1y v1z
        vertex v2x v2y v2z
        vertex v3x v3y v3z

More about STL format