NoUpload

JPG vs PNG vs WebP: which image format should you actually use?

Photographs want JPEG or WebP. Flat graphics, text and transparency want PNG or lossless WebP. AVIF wins on file size but costs compatibility and encode time.

NoUpload engineering teamLast updated

Key facts

  • JPEG is still the compatibility default for photographs; quality 80–85 is the useful range, and below 75 gradients start to band.
  • PNG is lossless and the right choice for screenshots, logos and transparency; a 12-megapixel photo as PNG is 20–40 MB where JPEG is about 3 MB.
  • WebP is typically 25–40% smaller than JPEG at equal visual quality and has been supported by every current browser since 2020.
  • AVIF is often 30–60% smaller than JPEG but encodes slowly and needs a codec download, so it is opt-in here.

Most format advice is a table of bullet points that ends with “use WebP for everything”. That advice is usually right and always incomplete. The choice depends on three properties of the image: how many distinct colours it has, whether it needs transparency, and whether it contains text or sharp edges.

Here is the decision process, in the order that actually matters.

Step 1: does the image have transparency?

If yes, JPEG is out — it has no alpha channel, so transparent areas become a solid block (usually black or white). Your options are PNG, WebP or AVIF.

If no, JPEG becomes a candidate and the decision moves to content type.

Step 2: is it a photograph or a graphic?

This single question predicts the answer better than anything else.

Photographs have smooth gradients, millions of colours and no hard edges. Lossy compression is designed for exactly this. JPEG at quality 80–85, or WebP at 80, will be indistinguishable from the original at normal viewing size and a fraction of the size.

Graphics — logos, screenshots, charts, UI mockups, text on a background — have large uniform areas and sharp edges. Lossy compression produces visible ringing and “mosquito noise” around letters. PNG or lossless WebP keeps them crisp.

A screenshot of a document is the classic edge case: it looks like a photo of text. It compresses far better as PNG, and if you must use JPEG, quality below 90 will make the text look dirty.

The honest comparison

JPEG PNG WebP AVIF
Compression Lossy Lossless Both Both
Transparency No Yes Yes Yes
Animation No No (APNG only) Yes Yes
Max colours 16.7 million 16.7 million 16.7 million 16.7 million
Typical photo size Baseline 3–8× JPEG 25–40% under JPEG 30–60% under JPEG
Typical graphic size Poor Baseline Slightly under PNG Under PNG
Encoding speed Fast Fast Fast Slow
Browser support Universal Universal Universal since 2020 Good since 2023
Metadata EXIF Limited Limited Limited

A note on those percentage ranges: they are relative and they are averages. A specific image can beat them or lose badly. The only trustworthy comparison is to encode your own file two ways and look at it.

JPEG: still the default for photos

JPEG has been the right answer for photographs for thirty years because it matches how human vision works: it discards high-frequency colour detail that we are bad at noticing, and keeps luminance detail that we are good at.

What to know in practice:

  • Quality 80–85 is the sweet spot. Below 75, gradients start to band and skin tones go blotchy. Above 90, file size climbs steeply for no visible gain.
  • Every re-save loses more. JPEG is lossy, so editing and re-saving compounds artefacts. Keep an original and export copies.
  • Progressive JPEG loads in passes and feels faster on slow connections, at a small size cost.
  • Chroma subsampling matters. 4:2:0 halves colour resolution; for images with saturated reds or fine coloured text, 4:4:4 is visibly better.

Use JPEG when you need maximum compatibility, when encode time matters, or when the image is a photograph that will be viewed at a reasonable size.

PNG: the right tool for graphics

PNG is lossless and supports alpha, which makes it the safe default for anything with text, flat colour or transparency. The downside is size: a 1200 × 800 screenshot can easily be 400 KB where the same content as WebP is 60 KB.

Two things make PNG smaller without changing a pixel:

  1. Palette reduction. A screenshot with 40 distinct colours does not need 24-bit colour. Converting to 8-bit palette PNG often cuts size by 70% with zero visual difference.
  2. Lossless re-compression. Encoders such as oxipng try hundreds of filter and compression-strategy combinations to find the smallest valid file. Typical savings on an editor’s default export: 5–25%.

This site’s image compressor runs oxipng on PNG output automatically for that reason.

Do not use PNG for photographs. A 12-megapixel photo as PNG is 20–40 MB; the same photo as JPEG is 3 MB and looks identical on screen.

WebP: the pragmatic upgrade

WebP exists in two modes and they behave like two different formats:

  • Lossy WebP is the JPEG replacement: photographs, 25–40% smaller at equal visual quality, with alpha support for free.
  • Lossless WebP is the PNG replacement: flat graphics and screenshots, usually 10–30% smaller than an optimised PNG.

Every browser released since 2020 reads WebP, which makes it the safest “modern” choice. It also animates, so it replaces GIF without the 256-colour banding.

Where WebP loses:

  • Very high quality settings. At quality 95+, WebP and JPEG converge, and JPEG sometimes wins.
  • Old pipelines. Some CMS uploaders, email clients and design tools still reject .webp. If the file is going into a system you do not control, JPEG or PNG is the boring, correct answer.
  • Fine photographic detail at small quality values. WebP can turn foliage and fabric into a smeared texture slightly earlier than mozjpeg does.

AVIF: best ratio, worst friction

AVIF is built on AV1 and produces the smallest files of the four — often 30–60% below JPEG at the same perceived quality. It supports alpha, animation and HDR.

The costs are real:

  • Encoding is slow. Seconds per image in single-threaded WebAssembly, versus milliseconds for JPEG. That is why AVIF output here is opt-in: the 3 MB encoder is fetched only when you choose it.
  • Decoding has a floor. Older phones decode AVIF in software, which drains battery and can stutter.
  • Support is good but not universal. Modern Chrome, Firefox, Safari and Edge handle it. Some image libraries and desktop viewers still do not.

AVIF is the right choice for a website where you control the delivery and can generate files ahead of time. It is the wrong choice for “email me this photo”.

What about GIF and HEIC?

GIF is a 1987 format with a 256-colour limit and no alpha gradients. It survives because it animates everywhere. For anything short and looping, an MP4 or WebM video is 10–50× smaller; for simple animation, animated WebP is smaller and better looking.

HEIC is what iPhones shoot by default. It is an excellent photographic format — roughly half the size of JPEG at the same quality — but support outside Apple’s ecosystem is patchy. If you are sharing photos with Android or Windows users, export to JPEG or WebP first.

A decision tree you can actually follow

  1. Needs transparency? → PNG for graphics, WebP for photos with transparent edges.
  2. Photograph? → JPEG at 82, or WebP at 80 if the destination accepts it.
  3. Screenshot, logo, chart, text? → PNG with palette reduction and lossless optimisation.
  4. Animation? → WebP, or video if it is longer than a few seconds.
  5. Archival master? → PNG for graphics, high-quality JPEG or the camera’s raw file for photos.

The step everyone skips: check the result

Whichever format you pick, the encoder settings matter more than the format name. A JPEG at quality 95 is bigger than a WebP at quality 60 and looks better; a “WebP” saved through a low-quality canvas pipeline can be worse than the original JPEG.

The only reliable test is side by side at 100% zoom. The compress tool here includes a comparison slider for exactly this — drag it across the image and look at edges, gradients and text before you commit to a batch.

If you only remember one thing: format choice narrows the range, quality setting decides the outcome.

Questions this guide answers

Is PNG better quality than JPEG?

PNG is lossless, so it preserves every pixel exactly; JPEG is lossy. But for photographs the file-size cost is enormous and the visible difference at quality 80–85 is negligible. Use PNG for text, flat colour and transparency, not for photos.

Which image format is best for websites?

WebP for photographs and graphics when you control delivery, with JPEG as the fallback for old pipelines. PNG remains correct for screenshots and transparent logos. AVIF is smaller again but slower to encode and less universally supported.

Does WebP work in every browser?

Every browser released since 2020 supports WebP, including Safari 14 and later. The remaining failures are usually upload pipelines, email clients and older desktop software, not browsers.

Sources