Skip to content

PNG vs JPG vs WebP vs AVIF: which image format to use

By Samuel Ogbodo · Last updated

Pick the wrong image format and you get a blurry logo, a photo that's ten times bigger than it needs to be, or a file a website won't accept. Four formats cover nearly every need today: PNG, JPG, WebP and AVIF. This guide explains how they differ, where each one fits, and gives a simple way to decide.

Two ways to shrink an image: lossless and lossy

Every format compresses images, because raw pixels take a lot of space. They do it in one of two ways.

Lossless compression packs the data more tightly but keeps every pixel exactly. Open the file, save it again, and nothing changes. It's ideal for sharp edges and flat colour, but it can't shrink detailed photos very far.

Lossy compression throws away detail that people are unlikely to notice, such as tiny colour variations and fine texture. It makes photos dramatically smaller, but each save loses a little more, and sharp edges such as text can pick up faint smudges known as artefacts.

With that in mind, here's what each format does.

JPG: the universal photo format

JPG (also written JPEG) has been the standard for photographs since the 1990s. It's lossy, with an adjustable quality level, and it opens on every device, browser, editor, printer and upload form.

  • Good for photos you send, upload, print or attach to documents.
  • Bad for logos, screenshots, diagrams and text, which get blurry edges; and anything with transparency, which JPG can't store.

PNG: lossless, with transparency

PNG is lossless and supports full transparency, so a logo can sit cleanly on any background. Its compression works best on large areas of flat colour.

  • Good for screenshots, logos, icons, diagrams, charts, and images you'll edit and save repeatedly.
  • Bad for photographs. A photo saved as PNG is usually several times larger than the same photo as JPG, with no visible benefit.

WebP: the everyday web format

WebP was created by Google for websites. It can be lossy or lossless, supports transparency and animation, and usually produces noticeably smaller files than JPG or PNG at the same visual quality.

According to MDN's image format guide, WebP works in all current versions of Chrome, Edge, Firefox, Opera and Safari. The main exception is Safari on older Macs: it needs Safari 14 or later on macOS Big Sur or newer.

  • Good for almost every image on a website, photos and graphics alike.
  • Bad for files you're sending to people or uploading to forms. Some older editors, Office versions and upload portals still don't accept it.

AVIF: the smallest files

AVIF is the newest of the four, based on the AV1 video codec. It usually compresses better than WebP, often making photos around half the size of a JPG at similar quality, and it supports transparency and high dynamic range.

Support has arrived in all major browsers. MDN lists Chrome 85, Edge 121, Firefox 93, Opera 71 and Safari 16.1 as the first versions to support it. Two drawbacks remain: many desktop apps and older devices can't open AVIF yet, and MDN notes that AVIF doesn't support progressive rendering, so an image appears only once it has fully downloaded.

  • Good for large photos on websites where every kilobyte counts, served with a fallback.
  • Bad for sharing and uploads, and for now anything that must open in older software.

Side by side

  • Compression. JPG is lossy; PNG is lossless; WebP and AVIF can be either.
  • Transparency. PNG, WebP and AVIF support it; JPG doesn't.
  • File size for photos. AVIF is usually smallest, then WebP, then JPG. PNG is by far the largest.
  • Compatibility outside browsers. JPG and PNG work everywhere. WebP is widely but not universally supported. AVIF is the least supported.
  • Best home. JPG for sharing photos, PNG for graphics and screenshots, WebP and AVIF for websites.

A simple way to choose

  1. 01Is it going on a website you control? Use WebP for everything, or AVIF for big photos with a WebP or JPG fallback using the HTML <picture> element, as MDN recommends.
  2. 02Is it a photo you're sending, uploading or printing? Use JPG.
  3. 03Is it a screenshot, logo, diagram or anything with text? Use PNG, or WebP on a website.
  4. 04Does it need a transparent background? Use PNG, or WebP or AVIF on a website. Never JPG.
  5. 05Is it an icon for a website or Windows? That's a job for ICO, a special icon format.

Common mistakes

  • Saving photos as PNG "for quality". A high-quality JPG is visually identical for photos at a fraction of the size.
  • Converting JPG to PNG to fix blur. Lossless can't restore detail the JPG already lost. It only stops further loss.
  • Re-saving JPGs over and over. Each save at lossy quality degrades the image a little more. Edit from the original, and export once.
  • Using full-size camera photos on websites. Format matters less than pixel dimensions. A 4,000-pixel-wide photo in a 1,200-pixel space wastes most of its bytes in any format. Resize first.

Converting between formats

The Image Converter converts between all four formats, plus GIF, BMP and ICO, and reads HEIC photos from iPhones. It runs in your browser, so images aren't uploaded. For JPG, WebP and AVIF you can set the quality; 90% is a good default for photos. To make files smaller without changing format, use the Image Compressor, and to change dimensions, the Image Resizer.

When converting, always start from the best original you have. Each lossy conversion adds its own small losses, so converting JPG to WebP to AVIF in a chain gives a worse result than converting the original once to each format you need.

Sources

Tools in this guide

More guides