What is a .STL file?

It depends. 2 unrelated formats use the .stl extension, so the name alone cannot tell you what you have. The bytes can: each format below starts differently, and dropping the file on our detector settles it in a second without uploading anything.

Stereolithography CAD (binary)

CAD · MIME type application/octet-stream

How to recognise it: No magic: an 80-byte header, then a 4-byte triangle count. If the file starts with the word solid it is ASCII STL instead..

Stereolithography CAD (text)

CAD · MIME type text/plain

How to recognise it: Text beginning with the word solid..

Why one extension, several formats

Extensions are a convention, not a registry. Any program can claim any three or four letters, and when two did so independently, both stuck. Operating systems resolve the clash by file association, so a double-click opens whichever application last registered .stl, which may be the wrong one. Looking at the first bytes removes the guesswork: a format's signature is fixed by its specification, while its extension is whatever the file was last named.

Check it from a terminal

# macOS and Linux
xxd -l 16 file.stl
file file.stl

# Windows PowerShell
Format-Hex -Path file.stl -Count 16