Skip to content
Images & filesImagesFormats

Which image format should you use

Format is the decision before compression, and the wrong one cannot be tuned away. What each format is actually built for, which to stop using, and how to serve more than one.

Ashish S Kumar6 min read

Compression settings get all the attention, and they are the second decision. The first is which format the picture should be in at all, and getting that wrong costs more than any quality slider can recover. A screenshot saved as JPEG is already damaged before you compress it; a photograph saved as PNG is several times larger than it needs to be and no amount of tuning will fix it.

The decision in one question

Almost every case resolves by asking what the image is made of, not what it is for.

  • Continuous tone — photographs, anything with gradients and soft edges. Lossy compression works well here because the eye tolerates the errors it introduces.
  • Flat colour and hard edges — screenshots, diagrams, charts, text, line art, logos. Lossy compression fails visibly here, smearing halos around every sharp boundary.
  • Geometry rather than pixels — icons, logos, simple illustrations that need to scale. These should not be raster images at all.

Convert between formats and compare the result

Runs in your browser — nothing is uploaded. Open the full image compressor

The formats, and what each is actually for

JPEG

Lossy, universally supported, no transparency. Still the correct default for photographs when you need something that works everywhere with no fallback. It discards high-frequency detail, which is why it handles skin and sky beautifully and text badly. Every save re-compresses, so repeated editing degrades it — keep an original and export from that rather than re-saving the export.

PNG

Lossless, with real alpha transparency. The right answer for screenshots, UI mockups, diagrams and anything containing text. The distinction that matters is palette depth: a PNG limited to 256 colours is dramatically smaller than a full-colour one and, for a flat-coloured diagram, visually identical. For a photograph PNG is simply the wrong tool — expect three to five times the size of an equivalent JPEG for no visible gain.

WebP

Does both jobs — lossy for photographs, lossless for flat graphics — and supports transparency in both modes. Typically 25–35% smaller than JPEG at comparable quality, and smaller than PNG for the same lossless content. Browser support is now effectively universal. For most sites this is the sensible default, with JPEG or PNG kept only as a fallback for old software outside the browser.

AVIF

The best compression of the four, particularly noticeable at low bitrates and on large photographic images, and it handles wide colour and high dynamic range that JPEG cannot represent. The costs are real: encoding is substantially slower, and support across non-browser tooling — email clients, older operating systems, whatever your client opens attachments in — is patchier than WebP. Excellent for a website you control, risky for a file you are sending someone.

SVG

Not a compressed picture at all but a description of shapes, so it is resolution-independent and usually tiny. For logos, icons and simple illustrations it is the correct answer and nothing else comes close. It is the wrong answer for photographs, and an SVG produced by auto-tracing a photograph will be larger and worse than the original.

TransparencyLossless optionBest for
JPEGNoNoPhotographs needing maximum compatibility
PNGYesYesScreenshots, diagrams, anything with text
WebPYesYesA sensible default for both, on the web
AVIFYesYesLarge photographs on a site you control
SVGYesVectorLogos, icons, illustrations that must scale

Formats to stop using

GIF survives out of habit. For animation it is worse than video on every axis — 256 colours, no real alpha, and file sizes many times larger than an equivalent clip. Use a muted, looping video, or animated WebP where a video element is impractical. For a static image GIF has no remaining case at all.

BMP and TIFF are not web formats and should not appear in a page. TIFF remains legitimate for print and archival masters; it just has no business being served to a browser.

Serving more than one

You do not have to choose a single format for a site. The `<picture>` element lets the browser take the first source it understands, so you can offer AVIF, then WebP, then a JPEG or PNG fallback, and every visitor gets the best format their software supports without any scripting.

The reason to do this rather than just serving one format is that the fallback costs you nothing at runtime — only build time and storage. The reason not to is that three encodes of every image is real complexity, and if your traffic is overwhelmingly modern browsers, WebP alone captures most of the benefit for a third of the work.

Whichever you pick, resize before you compress — a 4000-pixel photograph displayed 800 pixels wide is wasting most of its bytes regardless of format. That and the quality settings are covered in how to reduce image size without losing quality.

Resize to exact platform dimensionsOne image, every platform's exact dimensions.

Icons and favicons are their own problem

A favicon is rendered at 16 pixels in a browser tab and at 180 or more on a phone home screen, from the same source. An SVG scales across that range perfectly but is not accepted everywhere a favicon is requested, so the durable answer is still a small set: an SVG for browsers that take one, a couple of PNGs for the larger placements, and an ICO for the oldest path. An image auto-scaled down to 16 pixels from a detailed logo turns to mud — at that size the mark usually needs simplifying rather than shrinking.

Generate the icon set from one imageOne image in, a complete favicon set out.

Frequently asked questions

Should I use WebP or AVIF?
WebP for most sites — support is universal, encoding is fast, and the saving over JPEG is already substantial. AVIF when you are serving large photographs on a site you control and can afford the slower encode. Offering AVIF with a WebP fallback via `<picture>` gets both.
Is PNG always better quality than JPEG?
PNG is lossless, so it never discards data, but that only matters for the right content. On a photograph the lossless file is three to five times larger with no visible difference. On a screenshot the difference is immediately visible and PNG is the only sensible choice.
Why does my screenshot look blurry?
It was almost certainly saved as JPEG. Lossy compression works by discarding high-frequency detail, which is exactly what text and sharp UI edges are made of. Save screenshots as PNG or lossless WebP; the damage cannot be undone by re-saving.
Can I convert a JPEG to PNG to improve it?
No. The detail JPEG removed is gone, and PNG will losslessly preserve the artefacts along with the image, producing a larger file of identical quality. Convert in that direction only when you need transparency or are about to edit.
What format should a logo be?
SVG, in almost every case. It stays sharp at any size, is usually smaller than a raster equivalent, and can be recoloured with CSS. Keep a PNG alongside it for contexts that will not accept vector artwork, such as some email clients and social platforms.

Sources

  1. 1.Image file type and format guide — MDN Web Docs
  2. 2.Portable Network Graphics (PNG) Specification (Third Edition) — W3C
  3. 3.WebP — an image format for the web — Google