The Geometry Behind an STL File, Explained

After reading this you will know what a triangle mesh actually stores, how the viewer computes volume, surface area and bounding box from those triangles, and how to spot a broken mesh before it wastes a print.

What a mesh file really contains

An STL or OBJ file is not a solid. It is a shell built from flat triangles. Each triangle is three points in space plus a direction the surface faces, called the normal. There is no thickness, no material, no "inside" recorded anywhere. The solidity you see on screen is inferred entirely from which way the triangles face.

Consider a 20 mm cube. Each square face needs two triangles, so the cube is 6 faces times 2, or 12 triangles. That is the entire file. A sphere of the same size might need 5,000 triangles to look smooth, because curved surfaces are approximated by many small flats. This is the first thing the viewer tells you: the triangle count is a direct measure of how finely the surface was sampled.

STL stores every triangle independently, so a shared vertex is written once per triangle that touches it. A cube's 8 corners appear as 36 vertex entries (12 triangles times 3). OBJ can share vertices by index, so the same cube may list 8 vertices and 12 faces. Both describe identical geometry.

When to inspect before you print

Load a model here whenever you receive a file you did not make, before you slice it, or when a print failed and you suspect the geometry rather than the printer. The four numbers you want are almost always the same: overall size, so it fits the bed; triangle count, so you know how heavy the file is to slice; surface area, which drives support and paint estimates; and volume, which drives filament or resin cost.

This viewer is not a repair tool and not a slicer. It will not fix flipped faces, close holes, or generate toolpaths. It reports what the mesh is so you can decide whether to send it onward. For the money side of a print once the geometry checks out, use the 3D Print Cost & Time Calculator.

The bounding box and why it is the first check

The axis-aligned bounding box is the smallest box, aligned to the X, Y and Z axes, that contains every vertex. Computing it is a single pass over the points: track the minimum and maximum of each coordinate.

\text{size} = (x_{\max}-x_{\min},\; y_{\max}-y_{\min},\; z_{\max}-z_{\min})

Here x_{\min} and x_{\max} are the smallest and largest X values across all vertices, and likewise for Y and Z. The three differences are the width, depth and height. If any dimension exceeds your build volume, nothing else matters yet.

One trap: STL and OBJ carry no unit. The numbers are bare. Almost every printing workflow treats them as millimeters, but files exported from CAD in inches arrive 25.4 times too small if the slicer assumes millimeters. A part that should be 50 mm reads as 1.969, which is exactly 50 divided by 25.4. When a model looks tiny, suspect a unit mismatch first.

Surface area from triangles

Surface area is the sum of the areas of every triangle. For a triangle with vertices A, B and C, form two edge vectors and take half the length of their cross product.

\text{area} = \tfrac{1}{2}\,\lVert (B-A)\times(C-A) \rVert

The cross product (B-A)\times(C-A) is a vector perpendicular to the triangle whose length equals the area of the parallelogram spanned by the two edges. Half of that is the triangle. Sum over all triangles and you have the total surface area, exact to floating-point precision, whether or not the mesh is watertight. Surface area needs no closed shell, which is why the viewer reports it even for a broken model while it refuses to report volume.

Volume by signed tetrahedra

Volume is harder because a shell has no interior on its own. The trick is to pick any fixed reference point, usually the origin, and build one tetrahedron from that point to each triangle. Each tetrahedron gets a signed volume: positive if the triangle faces away from the origin, negative if it faces toward it. Add them all up and the overlaps cancel, leaving exactly the enclosed volume.

V = \sum_{i} \tfrac{1}{6}\,\big( A_i \cdot (B_i \times C_i) \big)

Here A_i, B_i, C_i are the three vertices of triangle i, and the expression A_i \cdot (B_i \times C_i) is the scalar triple product, which equals six times the signed volume of the tetrahedron from the origin to that triangle. The sign depends on triangle winding order, which is why consistent normals matter.

This method is exact only for a closed, correctly oriented mesh. If some triangles are wound backwards (inverted normals), their tetrahedra get the wrong sign and the sum is meaningless. That is why the tool warns instead of printing a confident but wrong number. A volume that comes out negative or absurdly small is the classic signature of flipped faces.

A worked example: the 20 mm cube

Reproducing the demo numbers

The demo loads a 20 mm cube centered on the origin, so its corners run from -10 to +10 on each axis. Walk the four readouts by hand.

  1. Bounding box. Each axis spans 10 - (-10) = 20. Size is 20 x 20 x 20 mm.
  2. Triangle count. Six faces, two triangles each, gives 12 triangles.
  3. Surface area. Each face is 20 x 20 = 400 mm^2. Six faces give 2400 mm^2. As a check, each face splits into two right triangles of area 200 mm^2, and 12 of them also total 2400.
  4. Volume. A cube is side cubed: 20^3 = 8000 mm^3, or 8 cm^3. The tetrahedron sum returns the same 8000.

Switch the readout to inches and the size becomes 0.7874 in per edge (20 divided by 25.4), area 3.72 in^2, volume 0.4882 in^3. The geometry did not change; only the unit label did.

The same cube in millimeters and inches. Each quantity is scaled to share one axis, showing how far apart the raw numbers sit once you switch units.

How triangle count trades off against smoothness

For a curved model the triangle count sets how close the flat approximation hugs the true surface. A sphere approximated by n segments around and up has a chord error: the flats sit inside the true radius by an amount that shrinks as segments rise. Doubling the segment count roughly quarters that error but doubles the file size. Past a point the eye and the printer nozzle cannot tell the difference, and extra triangles only slow slicing.

A sphere of radius 10 mm approximated with 8 segments shows visible flats and has a maximum surface deviation of about 0.76 mm; at 32 segments the deviation drops to about 0.048 mm and the surface looks smooth. More segments mean more triangles and a larger file with no visible gain past roughly 48.

Reading the results and common mistakes

Match each readout to a decision. Bounding box against build volume. Triangle count against slicer patience: files over a few million triangles slice slowly and gain nothing. Surface area feeds paint, coating and support estimates. Volume feeds material cost.

Inverted normals
Triangles wound backwards so the surface faces inward. The render often shows dark or see-through patches, and volume comes out wrong or negative.
Non-watertight mesh
Holes where edges do not meet. There is no closed interior, so volume is undefined and the tool warns.
Degenerate triangle
A triangle with zero area (two coincident vertices). It contributes nothing to area or volume but inflates the count.

The most frequent real-world errors, in order: assuming millimeters when the file was inches; trusting a volume number from a mesh that was never watertight; and judging smoothness by triangle count alone when the mesh has long thin slivers that add count without adding fidelity. If your model is a cabinet part or panel rather than a print, size it flat first with the Sheet Goods Cut Optimizer or the Cut List Optimizer.

Related tools

Once geometry is confirmed, the 3D Print Cost & Time Calculator turns volume into filament and money. For machined parts, the CNC Feeds & Speeds Calculator sets cutter RPM and feed. Woodworking layouts pair with the Roof Pitch & Rafter Calculator and the Stair Calculator when the model is a building element.

Frequently asked questions

Why is my model showing up microscopic?

Almost always a unit mismatch. The file was exported in inches, and the viewer or slicer read the numbers as millimeters. A 50 mm part reads as 1.969 (50 divided by 25.4). Multiply by 25.4, or re-export in millimeters.

Why does the volume read as a warning instead of a number?

The mesh is not watertight or has flipped faces, so the signed-tetrahedron sum would be wrong. Surface area still shows because it does not need a closed shell. Repair the mesh in a dedicated tool, then reload.

Is my file uploaded anywhere?

No. The geometry is parsed and rendered in your browser. Only the 3D engine (three.js, about 600 KB) is fetched once from a CDN and then cached.

Does a higher triangle count mean a better model?

Only up to the point where flats stop being visible. For a 10 mm sphere, going from 16 to 32 segments cuts surface deviation from 0.19 mm to 0.048 mm, a real gain. Going from 32 to 64 cuts it to 0.012 mm, below what most nozzles resolve, while doubling the file size.

Can it open OBJ files with textures?

It loads the geometry from OBJ, but materials and textures are ignored. You get the shape and all four readouts, shaded with the viewer's own lighting.