← Back to Guides

File Signatures (Magic Numbers)

How software really knows what a file is, regardless of its extension.

Extensions are a Lie

A file extension (like .pdf) is just a hint to the operating system. The true identity of a file is defined by its "magic number"—the first few bytes of the file header.

For example, every valid PDF begins with the hex bytes 25 50 44 46, which translates to %PDF in ASCII. A ZIP archive (and therefore a DOCX) always begins with 50 4B 03 04 (PK).

You can use our Hex Viewer to inspect the first bytes of any file to verify its true format.

Common Mistakes

  • Renaming a .docx to .pdf and expecting it to convert. It doesn't. It just creates a broken file.

Next Steps

Put this theory into practice. Use our client-side tools to inspect documents directly in your browser.

Open Developer Tools