By the ImageOpti team ·
AVIF vs WebP vs JPEG: Which Image Format Should You Use?
A plain comparison of AVIF, WebP and JPEG: file size, quality, transparency, browser support and encoding speed, plus a simple rule for choosing.
For most small sites, WebP is the practical default and JPEG is the safe fallback. AVIF usually gives the smallest files at similar visual quality, but it is slower to create and a little less universal in older software. The right choice depends on where the image will be used and how much effort you want to spend.
This article compares the three formats on the points that matter in practice, and avoids numbers that vary too much to quote. Where sizes differ, it describes the typical direction rather than promising a percentage.
The three formats in brief
JPEG has been the standard format for photographs since the early 1990s. It is lossy, so it makes files small by discarding detail. It has no transparency and no animation. It opens in virtually everything.
WebP was developed by Google and released in 2010. It supports lossy and lossless compression, transparency and animation. It generally produces smaller files than JPEG at comparable quality. All current major browsers support it.
AVIF is based on the AV1 video codec and is newer. It supports lossy and lossless compression, transparency, animation, and high dynamic range and wide colour. It usually produces the smallest files of the three for photographs. Current versions of Chrome, Firefox, Safari and Edge support it, though Safari support arrived later than the others, so people on very old devices may not see AVIF images.
Comparison table
| JPEG | WebP | AVIF | |
|---|---|---|---|
| Compression type | Lossy | Lossy and lossless | Lossy and lossless |
| Transparency | No | Yes | Yes |
| Animation | No | Yes | Yes |
| Typical file size for photos | Baseline | Often noticeably smaller than JPEG | Often smaller again than WebP |
| Browser support | Universal | All current major browsers | All current major browsers, newer than WebP |
| Support in older software | Universal | Patchy in some older programs | Less common than WebP |
| Time to create the file | Fast | Fast | Noticeably slower |
| Best for | Maximum compatibility | General web use | Squeezing out the smallest size |
"Smaller" varies with the image and the quality setting. Savings are often larger on smooth, detailed photographs and smaller on noisy or already heavily compressed ones. Anyone quoting a single exact percentage is simplifying.
File size and quality
All three are lossy for photos, so each file is a trade-off between size and fidelity. At low quality settings, they fail in different ways.
- JPEG shows blocky squares and ringing around edges, particularly in smooth gradients such as skies.
- WebP tends to smooth out fine texture, giving a slightly waxy look at low quality.
- AVIF also smooths detail at aggressive settings, but can often hold up visually at smaller sizes than the others.
At high quality settings the three become harder to tell apart on screen, and the file size advantage of newer formats shrinks in absolute terms.
A worked example
Imagine a hero photo that is 1600 by 900 pixels and comes out of a JPEG encoder at about 250 KB at a quality that looks good to you. The same visual result in WebP is typically somewhat smaller, and in AVIF smaller again. For a page with 10 such images, saving even 30 to 40 percent per image (an illustrative figure, not a promise) would remove roughly 750 KB to 1 MB from the page, which matters on slow connections.
If instead the image is a 20 KB thumbnail, the saving is a few kilobytes, which is rarely worth extra complexity.
Transparency
JPEG cannot store transparent pixels. If you convert a transparent image to JPEG, the see-through areas must be filled with a solid colour. WebP and AVIF both support transparency, so either can replace PNG for logos and cut-outs while usually being much smaller than the PNG. See PNG vs JPG vs WebP for how that compares.
Browser and software support
Browsers are the easy part. For a website, WebP is supported across current major browsers. AVIF is as well in current versions, though you may want to keep a fallback if you care about older devices.
Outside browsers it gets messier. Many email programs, print services, office tools, older photo editors, social platforms and upload forms accept JPEG and PNG only, or only some modern formats. A file that works perfectly on your site may be rejected by a form. In those situations, keep a JPEG version.
Encoding speed and effort
JPEG and WebP encode quickly, which is why browser-based tools can handle batches comfortably. AVIF encoding is much more computationally demanding, especially at high effort settings. For a small site with dozens of images, this is a minor inconvenience. For a site that generates thousands of images automatically, it can matter for build times and server load. Decoding AVIF is not a practical problem for typical visitors.
How to use more than one format on a page
You do not have to choose only one. The HTML <picture> element lets you offer several formats and the browser takes the first one it understands:
<picture>
<source srcset="photo.avif" type="image/avif">
<source srcset="photo.webp" type="image/webp">
<img src="photo.jpg" width="1200" height="800" alt="A description">
</picture>
The JPEG inside the <img> is the fallback for anything that supports neither. Always keep the width and height on the <img> so the page layout does not jump as images load. This and other image performance details are covered in image optimization for Core Web Vitals.
Many platforms and website builders now convert images to modern formats automatically. If yours does, check what it actually outputs before doing the work twice.
A simple decision guide
- Do you need the file to open everywhere (email, forms, print shops)? Use JPEG for photos and PNG for graphics.
- Is it for your own website and you want a simple, reliable improvement? Use WebP. See what WebP is and whether you should use it.
- Are you optimising a heavy page and willing to add a step? Try AVIF with a WebP or JPEG fallback.
- Does the image have transparency? WebP or AVIF for the web, PNG for places that need maximum compatibility.
- Is the image a small icon or logo with flat colours? SVG is often best, otherwise lossless WebP or PNG.
How to make each format
- JPEG and WebP: The optimizer re-compresses JPEG, PNG and WebP with a quality slider, so you can reduce an existing file and check the result with the before and after comparison.
- Conversion: The converter changes a file between formats in your browser, and can export AVIF as well as JPEG, PNG and WebP.
Whichever you pick, resize the image to the size it will be displayed at before converting. A format change cannot make up for sending far more pixels than a layout needs. The resizer does that, and how to reduce image file size without losing quality explains the order of steps.
Things to avoid
- Converting a JPEG to AVIF or WebP and expecting better quality. The conversion cannot restore detail already lost. You only get a different file, often smaller, with an added generation of loss.
- Re-saving a lossy file repeatedly. Always start from the original.
- Using AVIF everywhere without a fallback. Provide one if your audience includes older devices or if the file may be downloaded and reused elsewhere.
- Judging formats at a single quality number. Quality scales are not equivalent between formats. A "75" in one encoder does not look the same as a "75" in another. Compare by eye at the same displayed size.
FAQ
Is AVIF better than WebP?
Usually it gives smaller files at similar quality, but it takes longer to create and is slightly less supported in older software. For many sites, WebP is simpler and good enough.
Should I replace all my JPEGs?
Not necessarily. Replace the large, visible images first, since that is where savings are meaningful. Small images gain little.
Does Google prefer a certain format?
Google does not require a specific format. It recommends modern formats because smaller files load faster, but a well-optimised JPEG is perfectly acceptable.
Can I use AVIF for logos?
Yes, but for simple flat logos, SVG or PNG are usually better choices. AVIF shines on photographs.
Will AVIF open on my phone?
Current iPhones and Android phones can display AVIF in their browsers. Some apps and older operating system versions may not handle it, so keep a JPEG copy for sharing.
Related guides
For more on formats, see the image conversion guide, or the image workflow for developers if you build sites. To try the format, convert images to AVIF.