WordPress Images

WebP, AVIF, JPEG or PNG: How to Choose an Image Format and Stop Guessing

The answer depends on what is in the picture, and it always has.

Four formats, four questions, and one rule that beats all of them: get the size right before you argue about compression.

A batch processing dialog offering JPEG, PNG, WebP and AVIF

Every few years the internet decides there is a new best image format, and every few years the honest answer stays the same: it depends on what is in the picture. A photograph of a beach and a screenshot of a spreadsheet are different kinds of data, and no single format handles both well.

Here is the decision, made once, in plain terms, along with the reasoning so you can make it yourself the next time something changes.

What the formats actually do

Compression comes in two flavours. Lossless compression finds patterns and stores them compactly; unpack it and you get the original back, bit for bit. Lossy compression throws information away, choosing what to discard based on assumptions about human vision. It is not a bug, it is the entire point: our eyes are far more sensitive to brightness than to color, and far more sensitive to large shapes than to fine noise.

  • JPEG is lossy, from 1992, and understood by everything that has ever had a screen. It handles smooth gradients of color well and hard edges badly. It cannot store transparency.
  • PNG is lossless, handles transparency properly, and is excellent at flat areas of color and sharp edges. On a photograph it produces files several times larger than a JPEG that looks identical.
  • WebP does both: a lossy mode that beats JPEG by roughly a quarter to a third at the same visual quality, and a lossless mode that beats PNG. It supports transparency in both modes, which is the thing PNG could do and JPEG could not.
  • AVIF is newer, derived from video compression, and typically lands another twenty to fifty per cent below WebP. It is very good at gradients, which is where JPEG traditionally falls apart. It is slower to encode, and older software still trips over it.

The decision, in four questions

Does it need transparency?

If yes, JPEG is out. That leaves PNG, WebP or AVIF. For a logo or an icon with flat color, lossless is the right call and the file will be tiny anyway. For a cut-out photograph with a soft edge, lossy WebP or AVIF with an alpha channel will be dramatically smaller than PNG.

Is it a photograph or a graphic?

Photographs are continuous tone: millions of subtly different pixels, no hard edges except where objects meet. Lossy compression is designed for exactly this and the artefacts hide in the detail.

Graphics are the opposite: screenshots, diagrams, charts, anything with text or flat fills. Lossy compression hates hard edges. Put a screenshot through a JPEG encoder and you get a faint halo of noise around every letter, the visual equivalent of a bad photocopy. Use a lossless format, or a lossy one at a very high quality setting.

A batch processing dialog with format presets for JPEG, PNG, WebP and AVIF
The same decision, made once as a preset and then applied to whole folders rather than to one image at a time.

Does it have large smooth gradients?

Skies, studio backdrops, soft shadows, anything that fades gently from one tone to another. This is where JPEG shows banding: instead of a smooth transition you get visible steps, like contour lines on a map. AVIF is noticeably better here, and it is the one case where the newer format is worth the extra encoding time regardless of file size.

Who has to open it?

On a website, none of this matters, because the browser tells the server what it can read and you can serve different formats to different visitors. In an email attachment, a print shop’s inbox or a client’s ten year old design software, it matters enormously. JPEG and PNG are the two formats you can send anywhere without a conversation.

The quality slider is not a percentage

A quality setting of 80 does not mean the image is 80 per cent as good. The number is an index into a table of compression parameters, and the relationship between it and the visible result is not linear at all.

What matters in practice is where the curve bends. From 100 down to roughly 85, file size drops fast and almost nothing visible changes. From 85 down to about 70, size keeps dropping and only the most detailed areas start to soften. Below 60, the picture starts to look compressed and everyone can see it.

So the useful range for photographs on the web is 75 to 85, and going higher mostly buys file size rather than quality. The exception is any image that will be edited again later: every re-encode discards more, and the damage accumulates. Keep an untouched original, always.

Size beats format, every single time

This is the part people skip. A 4000 pixel wide photograph saved as a beautifully optimized AVIF is still a catastrophe if it is displayed in a 600 pixel wide column. You have compressed an image that should never have been that size.

Decide the largest size an image will ever be shown at, double it for high density screens, and resize to that before you think about format. A 1200 pixel JPEG at quality 80 will beat a 4000 pixel AVIF at any setting, on every measure that matters, on every connection.

Resize first, then choose a format, then set quality. Doing it in any other order means optimizing the wrong thing.

A working default

If you want one rule to apply without thinking:

  • Photographs on the web: resize to the display width times two, then WebP at quality 80, with a JPEG fallback if your stack needs one.
  • Screenshots, diagrams, anything with text: PNG, or lossless WebP if everything that touches it supports it.
  • Logos and icons: SVG if you have the vector, PNG if you do not.
  • Anything with a big smooth sky or gradient: AVIF, and look at it afterwards.
  • Anything you will send to another human being: JPEG or PNG.
A list of saved actions such as Web Optimized 1600px and Email Friendly 800px
Recording the sequence once turns a five step decision into one click for every image afterwards.

Do it in batches or you will not do it

The reason most sites are full of oversized images is not ignorance. It is that resizing and converting one picture at a time is dull, and dull work gets skipped under deadline.

The fix is to make the decision once and store it. Whatever tool you use, if it can hold a preset, define presets that match how your images are actually used: a full width hero, a card thumbnail, an email friendly version. Then converting a hundred images is one operation instead of a hundred.

Formats will keep changing. The reasoning will not: work out what kind of picture it is, get it to the right size first, choose lossy or lossless accordingly, and keep the original somewhere safe.

Table of Contents

Learn it by building something

Every week one thing you can make the same afternoon, from dynamic templates to 3D type. Written down step by step.

One mail a week, and then it ends.
Unsubscribe in one click.

Free

Chaos Art

Autonomous painters make one-of-a-kind abstract art in 3D space - gestures, art movements, painterly media, and embeds that paint a new original for every visitor.

Download the free WunderPaint Plugin for WordPress

The Image Editor & Design Studio

Everything described here can be done in the browser, on your own site. The live demo runs the full editor with nothing to install.

Design Tools

Brush & Paint Styles

Paint with six styles that mix pigment instead of blending it, pick from thirty-seven tips shown as real strokes, draw a tip of your own out of shapes, and let the color travel along the stroke.

Workflow & Automation

Dynamic Templates: Build the Design Once, Let Your Posts Fill It In

You build the layout once, tell a few layers where to get their content, and from then on every post, product or page renders its own version.

Print & Craft

Making Things That Fold: Dielines, Duplex and Why Previews Matter

A gift box, a paper crane, a bunting banner. They look simple, and they fail in ways flat design never does, because there is a second geometry underneath.

WordPress Images

Why Should a Design Become a File at All?

Every static graphic on a page is a snapshot of what was true when somebody exported it. There is a whole category of quiet wrongness that follows from that.