How to Tell What Format an Image File Actually Is
The name says .jpg, the program says the file is broken. Extensions are only labels, and the real format is written inside the file. Here is how to read it and what to do when the label is wrong.
Add any file and compare its extension with the format found from its first bytes.
Why the file name cannot be trusted
The extension is just text at the end of a name. Rename logo.webp to logo.png and the file is still WebP inside. Websites do this to you all the time: you save a picture, the browser quietly stores a WebP, and the name says .jpg. Software then complains that the file is corrupt, or an upload form refuses it. The reliable evidence is inside the file, in its first few bytes.
Check a file in one step
- Open Image Format Detector and add the file with Select File.
- Read the result table. It lists File name, File extension, Declared MIME type, Detected format, Signature bytes and Match.
- Look at Match. It reads either "File extension matches the detected format" or "File extension (.jpg) does NOT match the detected format (WebP)."
Reading the signature line
Most image formats start with a fixed pattern called a signature or magic number. The tool shows the first 12 bytes in hexadecimal and compares them with known patterns. You can read them yourself:
| Format | Starts with (hex) | Tell-tale |
|---|---|---|
| JPEG | FF D8 FF | Begins with the bytes FF D8 |
| PNG | 89 50 4E 47 0D 0A 1A 0A | "PNG" in ASCII after the first byte |
| GIF | 47 49 46 38 | "GIF8" in ASCII |
| WebP | 52 49 46 46 ... 57 45 42 50 | "RIFF", then "WEBP" at bytes 9 to 12 |
| BMP | 42 4D | "BM" |
TIFF files are recognised too, in both byte orders. The WebP case needs the extra check because RIFF is also used by other file types, so the tool also looks for WEBP at the right place.
What "Declared MIME type" tells you
The MIME type is what your browser guessed from the file name, so it usually repeats the extension. If it is empty, the tool shows "(not provided by browser)", which happens with unusual extensions. It does not prove anything about the content. Only the detected format does.
Formats it cannot name
The detector knows JPEG, PNG, GIF, WebP, BMP and TIFF. An iPhone HEIC photo or an AVIF image does not match any of these, so you see "Unknown / not a recognized image format" and "Could not identify format from signature." That does not mean the file is damaged. It means it is a format outside the list. Clues for the next step:
- An extension of .heic or .heif: use HEIC to JPG or HEIC to PNG.
- An extension of .avif: use AVIF to JPG or AVIF to PNG.
- No match and an extension you do not know: the file may not be an image at all, such as a PDF or a ZIP renamed to .jpg. Try Archive Viewer to see whether it is a ZIP.
Fixing a mismatch
When the extension and the content disagree, do not leave the wrong name in place, and do not just rename it to the format you want. Convert the file so the content matches the name:
- WebP saved with a .jpg name: WebP to JPG. The reason it happened is explained in why browsers save images as WebP.
- PNG named .jpg: PNG to JPG.
- JPG named .png: JPG to PNG.
One practical wrinkle: the converters on this site decide which files to accept by the type your browser reports, and that type comes from the file name. A WebP named photo.jpg is treated as a JPEG, so the WebP to JPG page skips it. The simple remedy is to rename the file to its true extension first, photo.webp, and then convert it. Renaming is safe here because you are making the label truthful. The conversion then writes a real JPEG.
A short routine for any suspicious file
- Drop it on the detector and note the detected format.
- If it differs from the extension, rename the file to the detected extension.
- Convert it to the format your destination wants, using the matching tool.
- Run the new file through the detector once more. The Match line should now be positive.
Why this matters for uploads and software
A form that checks content will reject a WebP with a .jpg name, while one that checks only the name will accept it and then fail later when it tries to process the image. Design and print software is stricter still. If an upload keeps failing with an unhelpful message, check the real format first, then the size, as in fixing an image an upload form keeps rejecting. The general trade-offs between the formats are in JPG vs PNG vs WebP.
The detector reads only the start of the file, in your browser. The file is not uploaded.
Frequently Asked Questions
Why is my .jpg file actually a WebP?
Browsers often save the WebP version of an image from a website and keep a .jpg name. The content is still WebP.
Which formats does the detector recognise?
JPEG, PNG, GIF, WebP, BMP and TIFF. HEIC and AVIF are not on the list and show as unknown.
What do the signature bytes mean?
They are the first 12 bytes of the file in hexadecimal. Each format begins with its own pattern, such as FF D8 FF for JPEG.
Should I just rename the file to match?
No. Convert it to the format you need so the content matches the name.
Does an unknown result mean the file is damaged?
Not necessarily. It may be a format outside the list, such as HEIC or AVIF, or not an image at all.
Is the file uploaded for checking?
No. The first bytes are read in your browser.