What a file really is, whatever its name says
Drop a file and compare its extension with the signature in the first bytes. Includes a spreadsheet name on an HTML page, and a JPEG name on a HEIC header.
By the Bytevive team7 min read

The letters after a dot are a name, not a measurement. A file called budget.xlsx can be a web page, and a file called IMG_2041.jpg can be a HEIC photo from an iPhone. Programs that trust the name open the file with the wrong reader, then report a format error that sounds like damage.
The bytes at the front are the part you can check. PNG files begin with an eight-byte signature. JPEG files begin with the start-of-image marker, FF D8. ZIP files, including every modern Word, Excel, and PowerPoint document, begin with PK. MP4, MOV, and HEIC files are all ISO base media files: a box named ftyp near the start carries a brand such as isom, qt, or heic. HTML has no magic number, but a file that starts with <!DOCTYPE html is not a spreadsheet.
What the first bytes say
The name is a label. The signature is the start of the file. This reads at most the first 1,024 bytes, on this device.
The first sample is a short HTML page named budget.xlsx. The name promises an Excel workbook. The bytes start with a tag. That is the situation behind Excel’s “file format or file extension is not valid” message when someone renamed a download, and it is not something a repair tool should pretend to fix. The second sample is only a HEIC file header, not a photograph, named as a JPEG. Windows Photos will not treat those bytes as a JPEG, because they are not one. See how to tell a renamed Excel file from a broken one and why HEIC photos will not open on Windows.
What a match does not prove
A matching signature only says the file starts the way that format starts. It does not say the rest arrived. A JPEG that was cut off still begins with FF D8, and the missing end is a different problem, covered in how a JPEG tells you it is not finished. A ZIP that begins with PK can still be missing the central directory at the end.
This page reads at most the first 1,024 bytes, in your browser. It does not upload the file, and it does not try to repair it. When the name and the bytes disagree, renaming the file to match the bytes is the honest first step. When they agree and the file still will not open, the damage is further in, which is what the repair tools are for (free account, in your browser, nothing uploaded).
Frequently asked questions
Does a matching signature mean the file is undamaged?
Why does Excel say the format or extension is not valid?
Is a .docx supposed to look like a ZIP?
How can I see the first bytes of a file without this page?
My photo ends in .jpg but the lab says HEIC. What now?
Sources
Every claim, error message, price, and limit cited above comes from these pages, checked on December 1, 2026. If one has changed, tell us at support@bytevive.com and we’ll update the article.
- PNG specification: file signature
- ITU-T T.81: JPEG start of image marker
- ISO/IEC 14496-12: ISO base media file format (ftyp box)
- Library of Congress: ISO Base Media File Format (the ftyp box)
- PKWARE APPNOTE: ZIP format
- Microsoft: Office Open XML file formats
- Microsoft Support: A file is in a different format than its extension indicates in Excel
- Microsoft Support: Photos app needs HEIF and HEVC extensions
- Microsoft PowerShell docs: Format-Hex


