Explainers

What Is the Difference Between JPEG, PNG and WebP?

JPEG for photographs, PNG for graphics and transparency, WebP for both at smaller sizes. Which to use where, and why saving a JPEG twice degrades it.

· 4 min read

What Is the Difference Between JPEG, PNG and WebP?

In short

JPEG uses lossy compression and suits photographs, where discarded detail is hard to see. PNG is lossless and suits graphics, logos, screenshots and anything needing transparency. WebP does both, typically 25 to 35 percent smaller than the equivalent JPEG or PNG, and is supported by every current browser.

The three formats exist because images fall into two very different categories, and no single format serves both well.

Lossy against lossless

Lossy compression throws information away permanently, choosing what to discard based on what human vision notices least. The file gets much smaller and the original cannot be recovered.

Lossless compression finds repeating patterns and stores them more efficiently, exactly as a zip file does. Nothing is lost and the original is perfectly reconstructable, but the savings are far smaller.

Which approach is better depends entirely on what the picture contains.

JPEG

Lossy, designed for photographs. It works by discarding fine detail and subtle colour variation that the eye struggles to see, particularly in areas of gradual change such as skies and skin.

Good for: photographs, and anything with smooth gradients and continuous tone.

Bad for: sharp edges, text, line art and flat areas of colour. The compression produces visible halos and blocky artefacts around hard transitions, which is why a screenshot saved as a JPEG looks smeared around the letters.

No transparency. A JPEG always has an opaque background, so a logo saved as one arrives on a white rectangle.

Quality setting. Usually expressed 0 to 100. Around 80 is the practical sweet spot: roughly half the file size of 95 with differences almost nobody can see on a screen.

The generation loss problem

Every time a JPEG is opened, edited and saved again, compression is applied afresh to data that has already been compressed. The artefacts compound with each cycle.

One save is invisible. Ten saves of the same file produce clearly visible degradation, particularly around edges and in flat areas where blocking appears.

The fix is to keep the original in a lossless format, edit that, and export a fresh JPEG each time. A JPEG should be an output, never a working file.

PNG

Lossless, designed for graphics. It compresses by finding repeated patterns, which works extremely well on flat colour and badly on photographic noise.

Good for: logos, icons, screenshots, diagrams, line art, anything containing text, and anything needing a transparent background.

Bad for: photographs, where the file can be five to ten times larger than an equivalent JPEG for no visible gain whatsoever.

Transparency: a full alpha channel, so edges can be genuinely soft rather than cut out against a fixed colour. This is PNG’s clearest advantage over JPEG and the reason it persists.

PNG-8 uses a 256-colour palette and produces very small files for simple graphics. PNG-24 handles full colour at larger sizes.

WebP

Developed by Google, WebP does both jobs. It has a lossy mode that generally beats JPEG at equivalent visual quality, and a lossless mode that generally beats PNG, while also supporting transparency and animation.

Typical savings are 25 to 35 percent against the equivalent JPEG or PNG at matched quality.

Browser support is now complete across current versions of Chrome, Firefox, Safari and Edge. The remaining caveats are outside the browser: some older desktop software, some email clients and some content management systems still handle it poorly or not at all.

Choosing

ContentBest choice
Photograph on a websiteWebP, with JPEG fallback if needed
Photograph to email or printJPEG
Logo or iconSVG if vector, otherwise PNG or WebP
ScreenshotPNG or WebP
Diagram containing textPNG or WebP
Anything needing transparencyPNG or WebP
Short animationWebP, or a video file for anything longer

SVG, the one that is not a bitmap

Worth mentioning because it frequently solves the problem better than any of the above.

SVG stores shapes as mathematical descriptions rather than as pixels, so it scales to any size without losing sharpness and the files are tiny. For logos, icons and simple diagrams it beats every bitmap format comfortably, and it stays crisp on high-density screens where a bitmap would need to be exported at twice the size.

It cannot represent photographs and is unsuitable for anything with photographic detail.

Size, which matters more than format

The largest saving available usually has nothing to do with the format at all.

A phone photograph is often 4,000 pixels wide. Displayed in an 800 pixel column, more than three quarters of those pixels are discarded by the browser after being downloaded over the visitor’s connection. Resizing before uploading typically cuts the file by 80 percent or more, which dwarfs any difference between formats.

Get the dimensions right first, then choose the format, then choose the quality setting. In that order, the format decision is worth perhaps a third of the total saving. Done in the wrong order it is worth almost nothing.

A practical workflow

Keep originals untouched in whatever the camera produced. Resize a copy to the largest size it will actually be displayed at, allowing for high-density screens if that matters. Export as WebP for the web at around 80 quality, or JPEG where compatibility with unknown software is a concern. Use PNG only where there is transparency or text.

That sequence produces files a fraction of the size with no visible difference, and it leaves an original you can return to when you later need a different crop or a larger version.

Common questions

Does saving a JPEG repeatedly reduce quality?

Yes. Each save re-applies lossy compression to already-compressed data, so artefacts accumulate. Editing and resaving the same JPEG many times visibly degrades it. Keep an original in a lossless format and export JPEGs from that.

Should I use WebP for everything?

For the web, largely yes, since support is now universal in current browsers and the files are smaller. Keep JPEG or PNG for anything that must open in older software, be emailed to unknown recipients, or be edited by someone else.

What about AVIF and HEIC?

AVIF compresses better than WebP and has good though slightly less complete browser support. HEIC is what iPhones produce by default; it is efficient but poorly supported outside Apple devices, which is why photos sometimes arrive unopenable.

Sources

Every factual claim above traces to one of these. Follow them rather than taking this article's word for it.

  1. Image file type and format guide MDN Web Docs
  2. Canvas API MDN Web Docs

Try it yourself

Free, instant, and nothing you enter leaves your browser.