Reading a file’s first bytes is faster than guessing its extension

A file’s extension is a label someone chose. Its first bytes are a record of what the writing application actually did. When a file refuses to open, read the first sixteen bytes before you touch the extension.

Photoshop writes 8BPS at offset 0. A PDF writes %PDF-. A ZIP — and therefore a DOCX, an EPUB, an APK and a Krita document — writes PKx03x04. AutoCAD writes a six-character release code such as AC1032. Those four checks cover a large share of the mis-named files people send us.

Our Signature Check tool does exactly this and nothing else: it reads the head of the file, prints the signature, and tells you which extension the content deserves.

Where this came from

Notes like this one come out of the file library rather than out of a release schedule. The pages linked above are the entries that were being worked on when the note was written, and those entries are rebuilt with each release of the toolset, so a note can go out of date in a way a format page does not.

When that happens the note stays where it is and gets a correction at the bottom rather than being rewritten, because the point of most of these notes is the order things were tried in. The editors who write them are the ones who maintain the catalogue.