Tell What a File Really Is MAGIC
An extension is just a label anyone can change; what a program reads is the signature inside the file. This reads that signature, names the real format, and tells you when the name on the file is lying.
The file
Drop a file here to read its signature — or
Drop any file. Only the first kilobyte is read, in the tab.
Why the name can lie
Renaming secret.exe to holiday.jpg does not change a single byte inside it — it still begins with MZ, the Windows executable signature, and Windows will still run it. The extension is a hint for the desktop, not a fact about the file. Every program that opens a file reads the signature instead, and so does MAGIC: it tells you what the bytes are, and when the name on the file disagrees with them.