convert2image

JPG, PNG, WebP or AVIF? Choose by what is in the picture

Ask which image format is best and you will usually get a history lesson: who invented what, which year, which licence. It is interesting, but it does not help much when you have a file in front of you and a box that says Save as.

A better starting point is the picture itself. Three questions settle almost every case.

1. Is it a photo, or is it drawn?

This is the big one, because the two kinds of image behave completely differently under compression.

Photographs are full of gentle variation. No two neighbouring pixels in a patch of sky are quite the same colour, and there is sensor noise everywhere. Lossless formats struggle with that randomness, because there is very little exact repetition to exploit. Lossy formats thrive on it, because they can smooth over small differences the eye would never notice.

Drawn images (screenshots, logos, charts, diagrams, interface mock-ups, most illustrations) are the opposite. They have large areas of exactly the same colour and hard edges between them. Lossless compression loves long runs of identical pixels. Lossy compression hates hard edges and leaves smudges and faint ripples beside them, which are especially obvious around text.

So the first rule is simple: photos want a lossy format, drawn things want a lossless one. JPG, lossy WebP and AVIF are the photo formats. PNG, and lossless WebP, are the drawing formats.

2. Does anything need to be see-through?

A logo that sits on a coloured page, a product cut-out, a sticker, an icon: these need transparency. JPG cannot store it at all. Save a transparent logo as JPG and the empty space becomes a solid box, usually white, sometimes black.

PNG, WebP and AVIF all support full transparency, including soft edges. GIF does too, but only on or off per pixel, which makes curved edges look jagged against anything but the colour they were designed for.

The interesting case is a photo that needs transparency, such as a product shot on a clear background. As a PNG it is enormous, because PNG has to store the photographic part losslessly. WebP and AVIF handle it well: lossy compression for the colours, with a clean transparency channel on top.

3. Where is it going?

This decides between otherwise equal choices.

  • Sending to a person, a form, a printer or an unknown app: use JPG for photos and PNG for everything else. Nothing is more widely supported. A surprising number of upload forms, print kiosks and older programs still reject WebP, and far more reject AVIF and HEIC.
  • Publishing on your own website: use WebP or AVIF. Every current browser displays both, and they are meaningfully smaller than JPG and PNG. Smaller images mean faster pages, particularly on phones.
  • Something you will keep editing: keep a lossless master, usually PNG or the original camera file, and make lossy copies from it when you need them. Re-saving a JPG again and again slowly degrades it.
  • Keeping for the long term: JPG and PNG are the safest bets. Both are decades old, openly documented and readable by everything. That matters more than the last 20 percent of file size.

Putting it together

The imageSharing or printingOn your website
PhotoJPGWebP or AVIF
Photo that needs transparencyPNG (large)WebP or AVIF
Screenshot, chart, diagramPNGPNG, or lossless WebP
Logo or iconPNG (or SVG if you have it)SVG, else PNG or WebP
Short animationGIFAnimated WebP, or a small video

What about WebP versus AVIF?

For photos on the web, AVIF usually wins on size, often by 20 percent or more over WebP at a similar look. It has two costs. Encoding is slow, which matters if you are converting thousands of images or generating them on the fly. And its support arrived later: Chrome in 2020, Firefox in 2021, Safari in 2022 and Edge not until 2024. WebP has been everywhere since 2020.

They also fail differently when pushed too hard. Over-compressed WebP goes a little blurry and blotchy. Over-compressed AVIF goes smooth and painterly, with textures like grass and hair turning to soft mush. Neither looks as bad as an over-compressed JPG, which breaks into visible blocks.

If you are unsure, convert one representative photo to both at a few quality levels and look at them side by side at full size. Your own images are a better guide than any benchmark.

The formats that did not make the table

HEIC is excellent for storing photos on an iPhone and awkward nearly everywhere else. Keep the originals if you like, but share JPG copies. BMP and uncompressed TIFF are huge and have no advantage for everyday use. TIFF still has a place in professional print and archiving, where its support for CMYK, high bit depth and multiple pages matters. GIF survives for animations people can drop into chats, but for anything else PNG replaced it long ago.

A quick check before you commit

When a choice matters, such as a hero image on a busy page or a batch of product photos, do not trust the defaults. Export the same image two ways and compare the file sizes and the details that matter: faces, text, fine textures, edges against the sky. It takes two minutes, and it is the only test that accounts for your particular pictures.