Skip to content
3DToolBench

Convert STL to GLB

GLB is the format the web uses for 3D: model-viewer, Sketchfab, three.js, AR on a phone. STL is what came out of your CAD program. Two things always go wrong in this direction, and both of them are settings on this page.

Drag a 3D file here, or.

This page is set up for STL files. Other formats we can read work here too.

The file is read on your own computer. It is never uploaded.

Add a file to switch this on.

Your file is read by your own browser and never sent to a server. There is no upload, no account and no copy of your model anywhere but on your computer.

The thousand-times problem

The glTF specification says one unit is one metre. STL says nothing at all, and everyone treats it as millimetres. So a 60 mm part converted without thinking becomes a 60 metre object, and in a web viewer that means the camera starts somewhere inside it and you see a wall of grey.

Set the input units to millimetres and the output units to metres, which is what this page does by default, and the model arrives at the right size in every glTF viewer.

The rotation problem

STL out of CAD or a slicer is Z-up. glTF is Y-up by specification. A model that goes across untouched lies on its back in every web viewer.

Set the output up axis to Y and the geometry is rotated as it is written. The marker in the corner of the 3D view shows which axis is up in the file that will be produced.

Shading

GLB stores a normal for every point, and the quality of those normals is what decides whether your model looks like a machined part or like melted plastic. They are rebuilt here from the geometry with a thirty degree crease angle, so flat faces stay flat and fillets come out smooth.

The result is one single binary file with the geometry and the material inside it. There is nothing else to upload alongside it.

The file is written uncompressed, and why that is the right default

glTF has an optional geometry compression called Draco that can shrink a mesh to a fifth of its size. It is not used here, for two reasons. It needs a decoder loaded alongside the model at the other end, so a Draco file is not a file you can simply hand to someone. And the encoder is a large piece of WebAssembly that every visitor to this page would have to download whether or not they wanted it.

If you are publishing to the web and the file size genuinely matters, compress it afterwards with gltf-transform or gltfpack, both of which do a better job than a converter could because they can also weld, reorder and quantise. For everything else — a model to send someone, a file for Sketchfab, an object for a viewer — an uncompressed GLB is what you want, because it opens everywhere with nothing else present.

What survives, and what does not

Kept in the GLB file

  • The exact shape
  • A correct scale for web and AR viewers
  • Properly creased normals for good shading

Lost on the way

  • Nothing: STL carries only triangles, and GLB holds all of them

How to convert STL to GLB

  1. Drop the .stl file in

    The model appears in the 3D view. That view is already a glTF renderer, so what you see is close to what a web viewer will show.

  2. Set the input unit to millimetres

    Almost every STL is millimetres, and glTF is specified in metres. Getting this wrong is the difference between a 60 mm part and a 60 metre one.

  3. Set the output unit to metres

    This is the default here. It makes the model the right size in model-viewer, Sketchfab, three.js and phone AR without anyone scaling anything afterwards.

  4. Set the output up axis to Y

    glTF is Y-up by specification and STL from CAD is Z-up. Skip this and the model lies on its back in every web viewer.

  5. Download the .glb

    One binary file with the geometry and a plain grey material inside it. Nothing else needs to travel with it.

STL and GLB compared

STL and GLB compared, row by row
PropertySTL.stlGLB.glb
File contentsBinary or plain text. Binary is an 80-byte header, a triangle count, then 50 bytes per triangle.One binary file: a small header, the same JSON as glTF, then all the buffers and images.
GeometryTriangles only. Curves are approximated when the file is made, and cannot be recovered.Triangles, with skinning weights and animation channels alongside them.
UnitsNone. The file stores bare numbers, and every reader has to guess what they mean.Metres, fixed by the specification.
Colour and textureNone. There is no place in the format for a colour, a material or a texture.Full physically based materials, with the texture images packed inside the file.
Separate objectsOne body. Several parts written into one STL become one undivided lump of triangles.A scene graph of named nodes, each with its own position and rotation.
Published by3D Systems, 1987, for the first stereolithography machines.The Khronos Group, 2015, as the single-file packaging of glTF.
Written byEvery CAD program and every slicer, as the common denominator.Blender, Sketchfab, Substance Painter, and every tool that ships models to the web.

Questions

Will this work with Google model-viewer?
Yes. GLB with metre units and Y up is exactly what model-viewer expects, and those are the defaults on this page.
Can I add a colour?
Not from an STL, because the file has no colour in it. The GLB is written with a plain grey material, which you can change in any glTF editor afterwards.
GLB or glTF?
GLB unless you have a reason not to. It is one file with everything inside it. A .gltf is JSON that usually points at other files, which makes it easier to edit and harder to move around.
Should I compress the GLB with Draco?
Only if you are publishing it on a page you control and you can load the decoder alongside. A Draco file will not open in most viewers on its own. Use gltf-transform or gltfpack afterwards if you need it.
Will the GLB open on an iPhone?
In a browser, yes, through any glTF viewer. For Quick Look — the AR view that stands the model up in the room — an iPhone wants USDZ instead, and there is a converter here for that.

Where to go next