Images & Codecs
7 min readPublished: 2026-10-18Updated: 2026-11-26

AVIF vs WebP vs JPEG: Choosing the Best Format for Web & Mobile

Images routinely account for more than half of the total bytes transferred on modern websites. Choosing deliberately between AVIF, WebP, and JPEG (especially encoded with MozJPEG) directly affects mobile data usage, scrolling responsiveness, and search metrics such as Largest Contentful Paint (LCP).

Key takeaways
  • AVIF produces files 40% to 55% smaller than standard JPEG and 20% to 35% smaller than WebP at comparable visual quality.
  • WebP strikes a practical balance between fast encoding, crisp lossless/alpha support, and nearly universal browser coverage.
  • Progressive MozJPEG with 4:2:0 chroma subsampling remains essential as a fallback for legacy clients and email newsletters.
  • Native HTML <picture> elements let browsers select AVIF first, fall back to WebP, and only touch JPEG on older clients with zero JavaScript overhead.

How AVIF, WebP, and JPEG compress visual data

All three formats exploit human visual perception to discard imperceptible detail, yet the algorithmic generation behind each standard creates dramatically different efficiency curves.

Classic JPEG (1992) splits images into fixed 8×8 pixel blocks and applies a Discrete Cosine Transform (DCT). Under aggressive compression, fixed block boundaries surface as visible "blocking" across smooth skies and "ringing" halos around sharp typography.

WebP builds on VP8 intra-frame video prediction using variable block sizes (4×4 up to 16×16) and adds an 8-bit alpha channel plus true lossless mode. AVIF goes further by leveraging the AV1 video codec: flexible partition trees up to 128×128 pixels, directional intra prediction, 10-bit/12-bit color depth, and cleaner preservation of subtle film grain and gradients without color banding.

Chroma subsampling and bit depth in real projects

For natural photography, 4:2:0 chroma subsampling halves color resolution along each axis for substantial byte savings with virtually invisible loss. For UI screenshots containing thin colored text or sharp vector edges, however, 4:2:0 blurs red and blue contours—making WebP lossless or 4:4:4 AVIF a noticeably cleaner choice.

Practical comparison: byte savings, CPU cost, and compatibility

Across real-world 1600×1067 product photographs tuned to roughly equivalent perceptual fidelity (SSIM ~0.96 and matched Butteraugli score), the size and compute trade-offs are summarized below.

Technical comparison of AVIF, WebP, and JPEG (MozJPEG)
Technical factorAVIF (AV1)WebP (VP8 / VP8L)JPEG (MozJPEG)
Typical size (1600px photo)68 KB – 95 KB105 KB – 135 KB165 KB – 220 KB
Alpha transparencyYes (8/10/12-bit)Yes (8-bit)Not supported
Lossless modeYes (often larger than WebP/PNG)Yes (~25% smaller than PNG)No (lossy only)
Encoding speedModerate to slow (higher CPU)FastVery fast
Budget mobile decodingModerate (faster with HW decode)Very fastInstantaneous
Modern browser supportChrome, Firefox, Safari 16+, EdgeUniversal in modern browsersUniversal (including email clients)

You can benchmark these exact presets interactively with a side-by-side slider inside the MediaPress image compressor to inspect actual KB savings before deploying.

When to ship AVIF, WebP, or JPEG

No single format wins every workload. Matching each asset class to the right encoder keeps build pipelines fast and pages responsive.

1. Hero photography, editorial covers, and e-commerce galleries

For above-the-fold images, shaving 50 KB off the primary asset directly accelerates first render on congested 4G connections. AVIF at quality 55–70 keeps skin tones, fabric textures, and sky gradients clean at roughly half the weight of standard JPEG.

  • Serve AVIF first via <source type="image/avif">.
  • Provide WebP at quality 75–82 as a fast-decoding secondary source.

2. UI screenshots, diagrams, and transparent cutouts

For software screenshots, sharp infographics, and transparent overlays that historically shipped as multi-megabyte PNG-24 files, lossless or near-lossless WebP preserves razor-sharp edges at a fraction of the weight.

3. HTML emails, corporate PDFs, and legacy integrations

Desktop mail clients and older document viewers still exhibit uneven support for AVIF and WebP. Outside modern web browsers, progressive MozJPEG (photos) and optimized PNG (logos) remain the safest delivery baseline.

Recommended HTML <picture> pattern with zero JS overhead

The cleanest production pattern lets the browser evaluate <source> declarations top-to-bottom and download only the first supported format.

Production-ready AVIF -> WebP -> JPEG markup

Always specify explicit width and height attributes to prevent Cumulative Layout Shift (CLS), and mark your primary hero image with fetchpriority="high".

<picture>
  <source srcset="/media/product-800.avif 800w, /media/product-1600.avif 1600w" sizes="(max-width: 768px) 100vw, 800px" type="image/avif" />
  <source srcset="/media/product-800.webp 800w, /media/product-1600.webp 1600w" sizes="(max-width: 768px) 100vw, 800px" type="image/webp" />
  <img
    src="/media/product-800.jpg"
    alt="Workstation laptop on studio desk"
    width="1600"
    height="1067"
    decoding="async"
    fetchpriority="high"
  />
</picture>

Common pitfall: quality scales are not linear across codecs

AVIF quality 60 does not correspond to JPEG quality 60. In AVIF, values between 50 and 68 regularly match JPEG 80–85 visually. Always verify dark gradients and small text at 100% zoom.

Convert and compare AVIF, WebP, and MozJPEG online

Upload images to MediaPress, tune quality or dimensions, and inspect pixel-level before/after compression results with zero permanent storage.

Keep reading

Learn how to tune CRF, pick between H.264, H.265, VP9, and AV1, downscale smartly, and enable faststart to shrink video files up to 75% without mushy artifacts.

Updated 2026-11-27Read full guide

Discover why PDFs swell to dozens of megabytes with 300+ DPI bitmaps and redundant objects—and how to shrink them cleanly while keeping text razor sharp.

Updated 2026-11-27Read full guide

Pick the right audio codec and bitrate for podcasts, UI sounds, and streaming players while avoiding generational transcoding loss and Safari playback traps.

Updated 2026-11-27Read full guide