← Guides

JPG vs PNG vs WebP vs AVIF: Which Format to Use

The two families: lossy and lossless

Lossless formats store every pixel exactly. Lossy formats discard information the eye is unlikely to notice and can shrink a photograph by an order of magnitude. The distinction explains most conversion results: JPG, WebP and AVIF can be lossy; PNG is always lossless. Converting a PNG screenshot to JPG at low quality will indeed be smaller — and will also make text edges shimmer.

What each format is good at

  • JPEG — universal, small for photographs, no transparency, no animation. Quality 80–90 is usually indistinguishable at normal viewing size.
  • PNG — lossless, supports transparency, ideal for screenshots, logos and images with flat colour or sharp edges. Photographs saved as PNG are often several times larger than the same photo in JPEG.
  • WebP — supports both lossy and lossless modes, transparency and animation. At similar visual quality it is typically 25–35% smaller than JPEG, and lossless WebP is usually smaller than PNG.
  • AVIF — based on the AV1 codec, the strongest compression of the four, with transparency support. Encoding is slow, and older software may not open the files.

Transparency is the deciding constraint

JPEG has no alpha channel. Anything transparent becomes white (or another flat colour) when converted, which is why logos with transparent backgrounds should stay PNG, WebP or AVIF. The same applies to converting a transparent PNG to JPG for a print shop: check whether they want the white background or a specific colour behind it.

Conversion does not always shrink a file

Re-encoding always costs something. Converting an already efficient WebP into PNG, or re-encoding a heavily optimised JPEG at the same quality, can produce a larger file. Every lossy pass also adds a little generation loss, so repeatedly converting JPG to WebP and back degrades the image. Convert once, from the best original you have, and keep that original.

What you gain and lose beyond size

Re-encoding strips EXIF metadata: camera model, exposure settings, capture time and GPS position. For publishing, that is usually a benefit. For archiving, it is data loss. Animation is another casualty: converting an animated GIF through a canvas keeps only the first frame, because canvas drawing has no concept of frames. Colour profiles can also change — wide-gamut images may be mapped into sRGB during the draw.

Browser support and fallbacks

JPEG and PNG work everywhere. WebP is supported by all current browsers and has been for years, so it is generally safe to serve directly. AVIF is supported by current Chrome, Firefox, Safari and Edge, but is not universal in older devices and desktop software. On a website, the usual approach is a <picture> element offering AVIF first, then WebP, then JPEG — each browser picks the first format it understands.

Choosing by content type

  • Photographs, hero images, gallery shots — JPEG, or WebP when the audience is on modern browsers.
  • Screenshots, diagrams, charts with text — PNG or lossless WebP; lossy compression makes text fuzzy.
  • Logos, icons, UI assets — PNG or WebP if transparency is needed, otherwise SVG is even better for flat vector shapes.
  • Bandwidth-critical delivery — AVIF or WebP with a JPEG fallback.
  • Print or hand-off to other software — PNG for lossless, JPEG at high quality for photos, TIFF when the print workflow expects it.

Metadata and file names

Changing the format does not change the file extension by itself, and a file renamed from .png to .jpg without conversion is still a PNG — some tools detect this and refuse it, others silently mis-handle it. Always convert the bytes, then use the matching extension. Tools that sniff the real format, as browsers do, are more forgiving than tools that trust the name.

Convert a batch with our image format converter: it reads JPG, PNG, WebP, GIF, AVIF and BMP, writes JPG, PNG, WebP or AVIF, shows before and after sizes, and can save the whole set as a ZIP. Everything runs locally in your browser.

Try it yourself: open the Image Format Converter →