You keep reading that WebP and AVIF make images smaller than JPEG and PNG, and you want to know what that means for your files. Both are newer formats that can store lossy or lossless pictures, transparency and animation. AVIF is documented as reaching higher compression and handling more bit depths, while WebP has the longer track record in browsers.

This guide shows how each format is built, how to read a claim such as "30% smaller" without being misled, and how to decide when to use them. It also explains why a JPEG or PNG fallback still belongs on your page.

What WebP stores

The format's own documentation describes two modes. Lossy WebP uses predictive coding, the same method the VP8 video codec applies to keyframes: it predicts the values in a block of pixels from neighboring blocks. Lossless WebP reuses image fragments it has already seen to rebuild new pixels exactly, and it can fall back on a local palette when no good match exists. A file holds VP8 or VP8L image data inside a container based on RIFF.

Both modes support transparency, and both appear in animated files. A web-platform media guide adds the color details: lossy WebP stores 8-bit Y'CbCr 4:2:0 data, and lossless WebP uses 8-bit ARGB, which is 32 bits per pixel. It also lists a maximum size of 16,383 × 16,383 pixels, which is 268,402,689 pixels, or about 268.4 megapixels.

The 32 bits matter for planning. A 1920 × 1080 picture in that layout is 1,920 × 1,080 × 32 ÷ 8 = 8,294,400 bytes before any compression. The image file size calculator gives the same figure, and every saving is measured against that raw baseline.

What AVIF stores

The AVIF specification defines how pictures coded with the AV1 video codec are stored in HEIF files, which build on the ISO base media file format. A still picture is an image item. An animated sequence is stored as AV1 data in a track. Transparency is an auxiliary image, and the specification requires it to use the same bit depth as the main picture.

AV1 supports 8, 10 and 12 bits per sample, and the specification states that the format handles high dynamic range (HDR) and wide color gamut as well as standard images. The color depth guide explains what those bit counts mean. Files use the extension .avif and the media type image/avif.

One limit comes from the media guide: AVIF does not support progressive rendering, so a file must be fully downloaded before it can be shown. The guide notes that this often matters little because the files are small, but that it can become noticeable for large files.

WebP and AVIF side by side

Feature WebP AVIF
Compression modes Lossy and lossless Lossy and lossless
Transparency Yes Yes (alpha as an auxiliary image)
Animation Yes Yes
Bit depth 8-bit in both modes 8, 10 or 12 bits
HDR and wide color gamut Not listed in the sources used Yes
Container RIFF-based HEIF
Media type and extension image/webp, .webp image/avif, .avif
Maximum size 16,383 × 16,383 pixels 2,147,483,647 × 2,147,483,647 pixels

For the older formats these two replace, see JPEG vs. PNG.

Reading a savings claim: from percent to ratio

The format's own documentation reports that lossy WebP images are 25-34% smaller than comparable JPEG images at an equivalent SSIM quality index (a numeric score for how similar two pictures are), and that lossless WebP images are 26% smaller than PNG. A web-platform media guide reports that lossy AVIF images are around 50% smaller than JPEG at visually similar compression levels.

Treat these as results for the comparisons their authors ran, tied to a quality measure. They are not a promise for your file. The saving you get depends on the picture and the encoder settings, just as the JPEG standard says the compression amount depends on the characteristics of the image.

Worked example. Example: a JPEG of 200,000 bytes. This size is assumed for the exercise, not measured. See what each reported saving would mean.

  1. 25% smaller: 200,000 × (1 − 0.25) = 150,000 bytes. Ratio: 200,000 ÷ 150,000 = 1.33:1.
  2. 34% smaller: 200,000 × (1 − 0.34) = 132,000 bytes. Ratio: 200,000 ÷ 132,000 = 1.52:1.
  3. 50% smaller: 200,000 × (1 − 0.50) = 100,000 bytes. Ratio: 200,000 ÷ 100,000 = 2:1.

Percent saved and ratio describe the same change. The compression ratio calculator converts between them for your own sizes.

For the idea behind the two modes, read lossless vs. lossy compression.

When to use them, and what to keep

The media guide recommends WebP or AVIF for raster images because they generally compress better than PNG, JPEG and GIF. It also says to provide a fallback, because WebP lacks deep historical support and AVIF support is newer still. The HTML <picture> element lets the browser pick the first format it understands:

html <picture> <source srcset="photo.avif" type="image/avif"> <source srcset="photo.webp" type="image/webp"> <img src="photo.jpg" width="1200" height="800" alt="Short description"> </picture>

Practical rules:

  1. Keep the original JPEG or PNG. Create the newer versions as extra files.
  2. Compare formats at similar visual quality, never at default settings alone.
  3. Fix the pixel dimensions first. A smaller format cannot rescue a picture with far more pixels than the page shows; see choosing image dimensions for the web.

Common mistakes

  • Treating a headline percentage as a guarantee. The reported figures describe comparison sets. Measure your own file before and after.
  • Converting a JPEG to lossy WebP or AVIF and expecting better quality. The JPEG already lost detail, and a second lossy step can only add more loss.
  • Reading the 26% figure as a JPEG comparison. That number compares lossless WebP with PNG, which is a different comparison from the lossy one.
  • Serving only the new format. Browsers that cannot read it show nothing. Add a JPEG or PNG fallback.
  • Comparing sizes at different quality levels. A smaller file is only a win if it looks equally good. The reported savings are tied to a quality measure for that reason.
  • Ignoring the lack of progressive rendering in AVIF. On a very large file, nothing appears until the whole download finishes.

FAQ

Is AVIF better than WebP?

The media guide says AVIF offers slightly better compression, but with less browser support and no progressive rendering. Which one is better for you depends on whether file size or reach matters more for the page.

Do WebP and AVIF support transparency?

Yes. Both store an alpha channel, both can be lossy or lossless, and both can hold animation.

Can I drop JPEG and PNG completely?

The guides advise providing a fallback for browsers that cannot read the newer formats, so keep a JPEG or PNG version.

What file extensions do they use?

WebP files end in .webp and use the media type image/webp. AVIF files end in .avif and use image/avif.

Sources

  1. Google for Developers (WebP project), An image format for the Web. Accessed November 6, 2026.
  2. Alliance for Open Media, AV1 Image File Format (AVIF). Accessed November 6, 2026.
  3. Mozilla (MDN Web Docs), Image file type and format guide. Accessed November 6, 2026.
  4. ITU-T, Information technology - Digital compression and coding of continuous-tone still images - Requirements and guidelines (Recommendation T.81). Accessed November 6, 2026.