For 3D printing, use STL: it is what every slicer and printer expects, and printing only needs geometry. For the web, use GLB: it is one self-contained file with colour and textures built in, made for fast loading in browsers. The two jobs pull in different directions. The 3D model viewer opens both so you can check a file before you commit.
Here is why each wins its lane.
Why STL wins 3D printing
A 3D printer cares about one thing: the shape it has to build, layer by layer. STL describes exactly that, a model as a mesh of triangles, with no colour, no textures and no animation. That simplicity is the point. Every slicer and every printer reads STL, so a model saved as STL will open wherever you take it. For getting one print-ready, see preparing an STL for 3D printing.
The newer 3MF format adds colour and richer data and is gaining ground, but STL is still the format you can hand to anyone and trust it will print.
Why GLB wins the web
The web needs the opposite of a stripped-down mesh. It wants colour, materials and textures, fast loading, and a single file with nothing to misplace. GLB delivers all of that: it packs geometry and textures into one binary file built for browsers, game engines and AR. If you are putting a model online or into a real-time scene, GLB is the reliable default. The comparison with its text sibling is in GLB vs glTF.
What to avoid for each
- Do not send a textured GLB to a printer expecting the colour to print; a standard printer ignores it and only uses the shape.
- Do not put a raw STL on the web expecting colour or materials; STL has none, so it shows as a single flat material.
- OBJ sits in between, fine for moving a model between tools, but usually converted to GLB for the web (see converting OBJ to GLB).
One master, two exports
The clean approach is to keep one detailed master model in your 3D tool and export the right format for the destination: STL when it is going to a printer, GLB when it is going online. To sanity-check either export, drop it into the 3D model viewer and confirm the shape, size and (for GLB) the textures look right, all in your browser.