A photo downloaded as photo.jpg won't open in some program, or an upload form rejects it as an unsupported format. A frequent cause: the name says JPG, but the contents are WebP or HEIC. The opposite move, renaming a .webp to .jpg to make a problem go away, is common too. That is not a format conversion.
The extension is just a label
The extension (.jpg, .png) is part of the file name. The operating system reads that label to decide which program opens the file, but renaming doesn't change a single byte inside. WebP-compressed data is still WebP data after the name becomes .jpg.
So a renamed file can run into trouble like this:
- A program that trusts the extension and hands the file to a JPG decoder may report it as damaged and refuse to open it.
- An upload form that only checks the extension may accept it, and then a later step that processes the contents fails.
- A program that looks at the contents opens it fine whatever the name, which is where the "it opens on my PC but not over there" confusion comes from.
Which behavior you get depends on the program or service. The reliable fix is to check the real format and, if needed, actually convert it.
Every format starts with a signature
Most image formats put a fixed value in the first few bytes of the file that says what format it is. This is called a signature or magic number. The same 64×64 picture was saved in several formats, and the first 16 bytes of each file were read. The highlighted cells below are the signatures.

| Format | Offset | Signature (hex) | As text |
|---|---|---|---|
| PNG | byte 0 | 89 50 4E 47 0D 0A 1A 0A | .PNG.... |
| JPG | 0 | FF D8 FF | (not text) |
| GIF | 0 | 47 49 46 38 + 37 61 or 39 61 | GIF87a / GIF89a |
| WebP | 0 and 8 | 52 49 46 46 … 57 45 42 50 | RIFF + 4-byte size + WEBP |
| BMP | 0 | 42 4D | BM |
| ICO | 0 | 00 00 01 00 | (not text) |
| TIFF | 0 | 49 49 2A 00 or 4D 4D 00 2A | II* / MM* |
| HEIC | 4 | 66 74 79 70 then a brand | ftyp + heic, mif1 and so on |
| AVIF | 4 | 66 74 79 70 then a brand | ftyp + avif |
A few notes:
- WebP lives inside a general-purpose container called
RIFF. Bytes 4 to 7 hold the file size and differ from file to file, so you have to read on toWEBPat byte 8 to know it's WebP (Google's WebP container documentation). - In HEIC and AVIF the first four bytes are a box size, so the signature starts at byte 4. Both use an
ftypbox and are told apart by the brand names that follow. In the files made here, the HEIC continued withmif1heicmiafand the AVIF withmif1avifmiaf. Both listmif1, somif1alone can't distinguish them. - In TIFF,
IIandMMmark the byte order used for numbers (Intel style and Motorola style). - An ICO can carry a whole PNG inside it. The ICO made with Pillow here showed the PNG signature (
89 50 4E 47) again starting at byte 22. - SVG is a text (XML) file rather than image data, so it has no fixed byte signature. Open it in a text editor and you'll see text that begins with
<svgor<?xml.
The W3C PNG specification says this 8-byte signature distinguishes PNG from other data and allows early detection of some transmission errors.
Checking a renamed file
A copy of a WebP file was renamed to renamed-photo.jpg; it's the last row in the figure. The name says JPG, but instead of the JPG signature FF D8 FF it starts with RIFF and WEBP. The contents are still WebP.
Windows: PowerShell's Format-Hex
Open PowerShell from the Start menu and enter the following, with the path changed to your file. This output is from Windows PowerShell 5.1, the version that ships with Windows.
Format-Hex -Path .\renamed-photo.jpg | Select-Object -First 1
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 52 49 46 46 14 03 00 00 57 45 42 50 56 50 38 20 RIFF....WEBPVP8
Select-Object -First 1 keeps only the first part; without it the whole file is printed. According to Microsoft's documentation, PowerShell 6.2 and later (including PowerShell 7) also accept an option such as -Count 16 to set the number of bytes. Only 5.1 was tried for this guide.
Mac and Linux: xxd
In a terminal, xxd shows just the first 16 bytes. The output below comes from the xxd bundled with Git Bash on Windows. Macs usually have xxd as well, but it wasn't run on a Mac for this guide.
xxd -l 16 renamed-photo.jpg
00000000: 5249 4646 1403 0000 5745 4250 5650 3820 RIFF....WEBPVP8
Where the file command is available, it names the format outright. In Git Bash, file renamed-photo.jpg answered RIFF (little-endian) data, Web/P image.
This site's converter decides the same way
This site's converter determines the format from the leading bytes of the file, not from the extension. It reads the first 1,024 bytes and matches them against signatures like those above. Inside an ftyp box it checks the AVIF brands before the HEIC ones, because AVIF files list mif1 too. And since the two letters BM can match by accident, it also checks the header size that follows before calling a file BMP.
Running the same detection code over the ten files above identified nine as the format their extension says and renamed-photo.jpg as WebP. So a misnamed file is still read and converted by its real format, and the file list notes which files had an extension that didn't match.
To make a WebP that's only named .jpg into a real JPG, it has to be converted. The result is a new file that starts with the chosen format's signature.
The files and tools used here are listed in how the measurements on this site were made.