You download an image ending in .png. It will not open in Photoshop. GIMP rejects it. The browser displayed it fine. What happened?
The png file is actually jpg (or WebP). Websites serve images as JPEG or WebP while the URL still says .png. This mismatch makes a file appear broken when it is not. Do not rename it. Check its real format first. Then convert it properly.
Why a PNG File Might Be a JPEG or WebP
Social media platforms and image hosts convert uploads to WebP or JPEG for speed. The download link keeps the .png name anyway. That is your fake png file.
Browsers are lenient. They read the internal signature, ignore the extension, and display the image. Image editors do not. They see a .png extension, look for a PNG header, find JPEG data, and refuse to open it. You get an error. Or garbage.
Another trap: using the browser's “Save As” function. The server sends WebP, but the dialog keeps the original .png file name. You save it. Now you have a WebP image wearing a .png mask.
How to Check the Real Image Format
Ignore the extension. To check real image format, read the file's internal signature, the magic bytes at the start. Every format declares itself in hex:
- PNG: 89 50 4E 47. You will see “‰PNG” in a text view.
- JPEG: FF D8 FF.
- WebP: “RIFF” at byte 0, then “WEBP” at byte 8.
- GIF: “GIF87a” or “GIF89a” right at the start.
Check on macOS or Linux
Open a terminal. Type file image.png. The output tells you the truth: “JPEG image data” or “WebP image”. No guesswork.
Check on Windows
Open the file in a hex editor. Look at the first bytes. Or use a small header-reading utility. Either way, you are reading the signature, not trusting the name.
What Happens When You Just Rename the File
Renaming changes nothing inside. You have a png is actually webp file. Rename it to .webp. The bytes are the same. The extension tells the OS which program to launch. The image data is untouched.
To fix a wrong file extension image, you convert. Use an image converter that reads the original format and re-encodes to the target format. Changing .jpg to .png does not add a PNG header. It does not decompress the JPEG data. It just lies to the next application that opens it.
Step by Step Fix a Mislabeled PNG
- Identify the real format. Use a signature checker or the
filecommand. - If it is actually a JPEG, open it in an editor that reads JPEG. Save a copy as PNG. The editor re-encodes the data. Remember: transparency is lost if a PNG is converted to JPEG. JPEG has no alpha channel. Converting a JPEG back to PNG will not recover transparency that is already gone.
- If it is WebP, use a WebP-to-PNG converter. Many free tools handle this in one step.
- After conversion, verify. The new file's signature must start with 89 50 4E 47.
Browsers open mislabeled files. Photoshop and GIMP do not. That is why the image looks fine in one place and broken in another. Proper conversion closes the gap.
Common Scenario PNG Saved as WebP from Browser
The classic png saved as webp from browser trap: you right-click an image, choose “Save image as…”, and the dialog offers a .png name. The server delivered WebP. The browser did not correct the extension. You saved WebP data with a .png suffix.
Check the signature. Confirm it yourself. Then convert the file with a WebP-to-PNG tool. If the original image had transparency, it survives the conversion. WebP supports alpha channels, so nothing is lost.
Changing the browser's save behaviour is possible but unreliable. Convert after the fact. It is the sure path.
Preventing the Problem in the Future
Before you save, look at the download dialog. Some browsers show the MIME type. That is the server telling you what it sent. Use it.
Browser extensions that force PNG downloads exist. They are not always reliable. The safest habit: verify the file signature after every download you plan to use in strict software. It takes seconds.
If you hit a corrupted image and suspect a format mismatch, png.repair can identify and recover the correct format.