PNG vs JPG vs WebP: Pick the Right Image Format — and Stop the White-Box Surprise
You've been here: you download a "transparent" logo, drop it onto your site's dark header, and there's a white box around it. Or your product photo looks perfect on your laptop and wrong on the marketplace. The problem i
You've been here: you download a "transparent" logo, drop it onto your site's dark header, and there's a white box around it. Or your product photo looks perfect on your laptop and wrong on the marketplace. The problem is almost never the tool you used. It's the format you saved in.
PNG, JPG and WebP look interchangeable in a file picker, but they store fundamentally different things. Pick the wrong one and you lose the transparency, the quality, or both — and you usually find out after the image is already live. Here's how the three formats actually differ, and a workflow that gets you the right file every time.
What a pixel actually stores
A JPG pixel holds exactly three values: red, green and blue. That's it. There is nowhere in the file to record "this pixel should be see-through", which is why a JPG can never be transparent. No setting, no trick, no converter changes that — the format simply has no room for the information.
A PNG pixel holds a fourth value: the alpha channel. Alpha says how opaque each pixel is, from fully solid to fully transparent, with soft steps in between. Those soft steps are what make hair and fur edges look natural instead of chopped off — the pixels along the edge are partly transparent, so the subject blends into whatever sits behind it instead of ending in a hard stair-step.
WebP has an alpha channel too, and it usually produces smaller files than PNG at similar quality. It can be lossy or lossless, which is part of why it's popular for websites — but not every upload form, marketplace or older piece of software accepts it yet.
The other split that matters is lossy vs lossless. JPG is lossy: every time you save, it throws away a little detail to shrink the file, and those losses stack up. Save the same photo as a JPG a few times and the edges go fuzzy, especially around text and logos. PNG is lossless: what you save is what you get, every time, which is why it's the safe choice for masters and cutouts. WebP lets you choose either way.
The difference at a glance
| PNG | JPG | WebP | |
|---|---|---|---|
| Transparency | Yes — full alpha channel | No — never | Yes |
| File size | Largest | Small | Smallest, usually |
| Quality loss | None (lossless) | Yes, every save | Optional |
| Accepted everywhere | Yes | Yes | Not yet — some upload forms refuse it |
| Best for | Cutouts, logos, masters | Finished photos on a set background | Your own website |
One line of that table does most of the work: transparency is a property of the format, not of the image. A photo of a logo on a white background is not a transparent logo, whatever the filename says.
Why your "transparent" image has a white box
If an image that should be transparent opens with a white (or black) box behind the subject, the transparency was lost somewhere between the export and the screen. The usual suspects:
- It was saved as a JPG at some point. Converting a transparent PNG to JPG fills the transparent pixels with a colour — usually white — and there is no way back. The reverse doesn't work either: converting a JPG to PNG just re-wraps the same solid pixels. A JPG-to-PNG file is a PNG with a white box built in. To get real transparency you have to remove the background first, then save as PNG.
- Someone screenshotted it. A screenshot captures what is on screen, including the background the image was shown against. Send the file itself, never a screenshot of it.
- An app flattened it. Some editors and messaging apps flatten transparency on export or on send. If the file looks right on your machine and wrong after sharing, re-export as PNG and check the file itself.
The quick test: open the image against a dark background or a checkerboard pattern. If the subject sits cleanly on it, the transparency is real. If there's a box, the transparency was lost upstream — fix the export, not the image.
Hands-on workflow: from photo to the right file
This is the workflow I use, with FreeToolBox — a set of free image tools that run entirely in the browser. Nothing is uploaded, there's no account, and the background remover, compressor, resizer and photo editor are all on the same site. The steps work with any tools, though; the order is the point.
Step 1 — Remove the background. Drop the photo into the background remover on freetoolbox.tech. The AI model runs on your own device, finds the subject, and gives you a transparent cutout. Product shots, portraits, logos — most images work. The tips that matter most: use a photo where the subject stands out clearly from what's behind it, and use good, even lighting. Fine hair and fur work best against a plain, contrasting background.
Step 2 — Check the transparency before you do anything else. Download the cutout as a PNG and open it against a dark background. Look at the edges, not the middle — that's where a bad cutout shows: a halo of background around the head, hair that looks chewed, a corner of the product missing. If the edges are rough, try a sharper photo with better contrast between the subject and the background. Fixing the source photo beats fighting the export settings.
Step 3 — Keep the PNG as your master copy. This is the full-quality, transparent version. Never overwrite it. Every other version you need — a listing image, a website hero, a thumbnail — gets exported from this master, not re-saved from a previous export. That way you never stack JPG losses on top of each other.
Step 4 — Make a web version the right size. A transparent PNG of a photo can be large, because every edge pixel is unique. Two things shrink it without hurting quality. First, serve the size you actually display: if the image shows at a few hundred pixels wide, resize it to that size with the Resizer instead of letting the browser shrink a huge file. Second, if the image will always sit on one background colour, place the cutout on that colour first and then save — a filled background compresses far better than millions of unique edge pixels. The Compressor handles the final squeeze on JPG, PNG and WebP.
Step 5 — Pick the format per destination. This is where the table comes back. A listing image on a white background can be a JPG — nothing needs to stay transparent once the background is set. A logo is always a transparent PNG. Your own website gets WebP where it's supported, with PNG as the fallback. Print gets the transparent PNG at the largest size you have.
Which format for which job
- Marketplace listings (Daraz, Amazon, eBay): cutout on white, exported as PNG or JPG. White background plus JPG is fine in the final listing because nothing needs to stay transparent.
- Logos and design work: transparent PNG, always. It drops onto any colour, photo or document without a box.
- Your own website: transparent WebP if your site supports it (smaller means faster), PNG as the fallback.
- Print: transparent PNG at the largest size you have. Avoid re-saving as JPG — you lose the transparency and gain fuzzy artefacts around the edges.
Four mistakes that undo the whole job
- Saving a cutout as a JPG. The transparency dies the moment you do, and the white box is baked in.
- Screenshotting a transparent image instead of sending the file. The screenshot has a background; the file doesn't.
- Re-saving a JPG over and over. Each save costs a little quality, and the damage shows first on edges and text. Keep a lossless master and export fresh copies.
- Using WebP where it isn't accepted. It's the best format for your own site, but some upload forms and older software still refuse it. Check the destination before you commit to it — PNG is the safe fallback everywhere.
The rule of thumb
If something needs to stay see-through, it has to be PNG or WebP — JPG is out by design. If nothing needs to stay transparent, JPG is usually the smallest honest choice. And if you keep one master copy as a transparent PNG and export everything else from it, you stop losing quality to repeated saves and stop discovering white boxes after the image is already live.
Try the workflow yourself: the background remover, compressor, resizer and photo editor are all free and in-browser at freetoolbox.tech — no sign-up, no watermark, and your photos never leave your device. And if you want the short version of this guide, the original is the Transparent PNG vs JPG vs WebP guide on the FreeToolBox blog.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.