WebP vs. AVIF
The short answerWebP and AVIF are both modern image formats that make smaller files than JPEG and PNG. AVIF usually compresses further and supports HDR and higher bit depths, but it is slower to encode. WebP is faster to encode, stronger for lossless images and supported by more older software.
WebP and AVIF are image formats designed to make web pages lighter than JPEG, PNG and GIF allow. Google introduced WebP in 2010, based on the VP8 video codec. AVIF came from the Alliance for Open Media and stores images compressed with the AV1 video codec. Both support lossy and lossless compression, transparency and animation, and all major browsers support both, so the choice comes down to file size, image quality, encoding speed and compatibility.
| WebP | AVIF | |
|---|---|---|
| Developed by | Google, first released in 2010 | The Alliance for Open Media, with its specification finalized in 2019 |
| Based on | VP8 video coding for lossy images, plus a separate lossless codec | AV1 video coding, stored in a HEIF container |
| File size | Smaller than JPEG and PNG at similar quality | Usually smaller than WebP at similar quality, especially at high compression |
| Color depth and HDR | 8 bits per channel, with no HDR support | Up to 12 bits per channel, with HDR and wide color gamut |
| Color detail | Lossy mode always uses 4:2:0 chroma subsampling | Supports full 4:4:4 color, which keeps colored edges and text sharper |
| Lossless | Efficient lossless mode, often smaller than PNG | Lossless mode exists but is usually less efficient than WebP's |
| Encoding speed | Fast to encode and decode | Slower and more demanding to encode, especially at high-effort settings |
| Compatibility | Supported in all major browsers and widely across image tools | Supported in all major browsers, with narrower support in older software |
How WebP works
WebP was introduced by Google in 2010. Its lossy mode is based on the intra-frame coding of the VP8 video codec, and it has a separate lossless mode designed for graphics and images that need exact pixels. Files are stored in a RIFF container and can include transparency, animation, color profiles and metadata.
WebP's lossy mode uses 8 bits per channel and always stores color at reduced resolution, known as 4:2:0 chroma subsampling. That keeps files small and decoding fast, but it can soften fine colored detail, and the format can't carry HDR.
How AVIF works
AVIF, the AV1 Image File Format, was developed by the Alliance for Open Media and finalized in 2019. It stores images compressed with the intra-frame coding of the AV1 video codec inside a HEIF container. It's royalty-free and supports transparency, animation and lossless compression.
AVIF handles 8, 10 and 12 bits per channel, HDR, wide color gamut and full-resolution 4:4:4 color. Its compression is very efficient, especially at small file sizes, where it tends to smooth over fine detail rather than show blocky artifacts. The cost is encoding time: producing a good AVIF can take much longer than producing a WebP of the same image.
Key differences in practice
For photos on the web, AVIF usually produces smaller files than WebP at the same visual quality, which helps page speed on slow connections. WebP's strengths are speed and maturity: it encodes quickly, decodes cheaply and is supported by more image editors, content management systems and older devices.
For graphics, screenshots and images that must be lossless, WebP's lossless mode is often the better option, since AVIF's lossless files tend to be larger. AVIF is the only one of the two that can carry HDR and higher bit depths.
When to choose WebP
Choose WebP when you want an upgrade from JPEG and PNG with fast encoding, for example when images are converted on upload or on the fly. It's also a good choice for lossless graphics, screenshots and animations, and when images must work across a wide range of software beyond browsers.
When to choose AVIF
Choose AVIF when file size matters most, such as for large photos and hero images, or when you want HDR, wide color or 10-bit images. It works best when you can encode ahead of time and the extra processing doesn't slow your workflow.
Many sites serve both with the picture element: AVIF first, WebP as the fallback and JPEG or PNG for anything else, so each browser gets the best format it supports.
The verdict
Choose AVIF for the smallest photos and for HDR or high bit depth, when you can afford slower encoding. Choose WebP for fast conversion, lossless graphics and broader support in older software. If your setup allows it, serve AVIF with a WebP or JPEG fallback through the picture element and get the benefits of both.
Published