logoimghosting
Blog Post

WebP vs AVIF in 2026: Which Image Format Actually Wins for Speed, Quality, and Browser Support?

WebP dominated the last decade, but AVIF is rewriting the rules in 2026. We benchmark both formats across file size, visual quality, encoding speed, and real-world browser support—so you can pick the right format for your project today.

For years the answer to "which image format should I use on the web?" was simple: convert everything to WebP and call it a day. WebP slashed file sizes vs JPEG, Chrome loved it, and even Safari eventually caught up. Job done.

Then AVIF arrived. Built on the AV1 video codec, AVIF promises even smaller files, better colour fidelity, and HDR support. But does it actually beat WebP in the real world—and is 2026 finally the year you can ship it without worrying about browser gaps? This deep-dive gives you benchmark numbers, side-by-side quality comparisons, encoding workflow tips, and a plain-English verdict.

File Size Winner

AVIF

~20–35% smaller than WebP at equal visual quality in controlled tests

Encoding Speed

WebP

WebP encodes 10–40× faster at comparable quality, crucial for on-the-fly pipelines

Browser Coverage 2026

Both ≥ 95%

AVIF finally cracked 95% global support—safe to ship with a JPEG fallback

01 · Format Basics

What Makes WebP and AVIF Different Under the Hood?

Both formats are designed to replace JPEG and PNG on the web, but they come from completely different lineages. Understanding those roots explains their trade-off profile.

W

WebP

Released by Google · 2010

  • ▸Derived from the VP8 video codec (intra-frame compression)
  • ▸Supports lossy, lossless, and animated variants
  • ▸8-bit colour depth only (no HDR in lossy mode)
  • ▸Mature tooling: Sharp, FFmpeg, Squoosh, cwebp all handle it effortlessly
  • ▸Fast hardware-accelerated decoding on most devices
A

AVIF

Released by Alliance for Open Media · 2019

  • ▸Derived from the AV1 video codec (keyframe slices)
  • ▸Supports lossy, lossless, and animation (AVIS sequence)
  • ▸Up to 12-bit depth, wide colour gamut (P3), HDR (PQ/HLG)
  • ▸Tooling maturing fast: libavif, Sharp ≥ 0.33, ffmpeg with libaom
  • ▸Slower encoding—especially at low speeds/high quality settings
Key codec insight: Both formats borrow from video codecs because video compression has decades of R&D invested in reducing redundancy in natural scenes—exactly the same challenge photos face. AVIF borrows from a newer codec (AV1 vs VP8), so its compression maths are fundamentally better, which is why it wins on file size. The trade-off is compute: AV1 was designed for video encoding pipelines with dedicated hardware, not real-time single-image encoding on a web server CPU.

02 · Size Benchmarks

Real File-Size Numbers You Can Actually Trust

Marketing pages love to quote the best-case scenario. Below are benchmark ranges drawn from published studies (Cloudinary Research, Google Web.dev, Netflix Technology Blog) across 1,000+ diverse images including photos, graphics, and UI screenshots.

Source Format → WebP Saving → AVIF Saving Notes
JPEG (photos) 25–35% smaller 40–55% smaller Most dramatic gains on photographic content
PNG (graphics) 15–40% smaller 20–50% smaller Varies heavily; flat-colour PNGs may see less gain
PNG (screenshots / UI) 10–25% smaller 15–35% smaller Sharp edges resist codec compression slightly
WebP → AVIF — 10–25% smaller At matched perceptual quality (SSIM, DSSIM)
GIF (simple animation) 60–80% smaller 65–85% smaller Animated WebP / AVIF both massively outperform GIF
Important caveat: These savings assume equal perceptual quality using metrics like SSIM. If you blindly set AVIF quality=80 vs WebP quality=80, you are not comparing apples to apples—AVIF's quality scale produces different visual results. Use a perceptual metric (DSSIM < 0.005 is a common threshold) or a tool like Squoosh side-by-side to match quality before measuring.

03 · Browser Support

Can You Actually Ship AVIF in 2026?

Browser support was AVIF's Achilles heel in 2021–2023. The situation has changed dramatically. Here's the state of play as of late 2026.

Browser WebP AVIF AVIF Notes
Chrome 120+ ✓ Full ✓ Full Supported since Chrome 85 (2020)
Firefox 125+ ✓ Full ✓ Full AVIF since Firefox 93; animation since 113
Safari 17+ (macOS Sonoma+) ✓ Full ✓ Full AVIF since Safari 16.4 (March 2023)
Edge 120+ ✓ Full ✓ Full Chromium-based; same as Chrome
Samsung Internet 24+ ✓ Full ✓ Full Chromium-based
IE 11 / Legacy Edge ✗ None ✗ None Dead browsers — use JPEG fallback
2026 verdict on support: Global AVIF support sits around 95–96% (caniuse.com data, Oct 2026). That's the same coverage WebP had in 2021 when everyone agreed it was safe to deploy. AVIF is now safe to ship as your primary format—just keep a JPEG fallback inside a <picture> element for the remaining edge cases.

04 · Encoding Speed

The One Area Where WebP Still Dominates

If browser support is AVIF's biggest historic weakness, encoding speed is its present weakness. The AV1 codec was optimised for quality, not for the ultra-fast single-image encoding that image hosting pipelines demand.

WebP (cwebp, quality 80)

~50 ms

per 2 MP image on a modern server CPU. Perfectly fine for real-time on-demand encoding.

AVIF (libaom, speed 6, quality 60)

~800 ms – 3 s

per 2 MP image. Speed 0 (best compression) can take 30–90 s. Only suitable for batch/background jobs.

The gap narrows with hardware encoders (Apple Silicon's AV1 encoder, Intel Arc GPU) and newer encoders like rav1e and SVT-AV1, which can hit ~200–400 ms at quality settings most people can't distinguish from libaom. But even there, WebP is faster. For upload pipelines that need to convert images the moment a user submits them, WebP is still the safer default.

convert-pipeline.mjs Node.js · Sharp
// Sharp 0.33+ supports both WebP and AVIF natively
import sharp from 'sharp';

// ✅ WebP — fast, great for real-time conversion
async function toWebP(inputPath, outputPath) {
  await sharp(inputPath)
    .webp({ quality: 82, effort: 4 })  // effort 0-6, 4 = good balance
    .toFile(outputPath);
}

// ✅ AVIF — smaller files, best for batch/background jobs
async function toAVIF(inputPath, outputPath) {
  await sharp(inputPath)
    .avif({
      quality: 60,   // AVIF 60 ≈ WebP 82 perceptually
      effort: 4,    // 0 (fastest) → 9 (smallest); 4–6 for production
      chromaSubsampling: '4:2:0'
    })
    .toFile(outputPath);
}

// 💡 Strategy: convert to WebP on upload (fast),
//    queue AVIF conversion in background worker.

05 · Use Cases

When to Pick AVIF, When to Stick With WebP

Use AVIF when…

  • ✓ Hero images and banners — above-the-fold visuals where every KB affects LCP. The encoding delay is acceptable for pre-rendered or batched assets.
  • ✓ Photography galleries and e-commerce product shots — high visual fidelity matters; file size reduction is worth the encode time.
  • ✓ HDR / wide-gamut content — AVIF supports P3 and HDR; WebP lossy does not.
  • ✓ Static site assets (build-time conversion) — Vite, Next.js Image, Astro all pre-convert at build, so encoding latency is irrelevant.
  • ✓ Bandwidth-constrained users — mobile-heavy audiences on emerging-market networks benefit most from maximum compression.

Stick with WebP when…

  • ✓ Real-time upload pipelines — user uploads trigger instant conversion; a 50 ms WebP encode beats a 2 s AVIF encode every time.
  • ✓ Animated images replacing GIF — animated WebP has broader tooling support and faster encode vs animated AVIF sequences.
  • ✓ Low-spec server environments — shared hosting or single-vCPU containers where AVIF encoding would saturate the CPU.
  • ✓ Thumbnails and avatar images — tiny images gain little from AVIF's extra compression while paying full encoding cost.
  • ✓ Teams without CDN format-negotiation — if you can only serve one format and can't use <picture>, WebP's universal support is safer.

06 · Serving Strategy

The Right Approach: Serve Both with Smart Fallbacks

The best production pattern in 2026 is not "pick one format"—it is storing your original upload safely and delivering the right format for each browser automatically. Here's how to do that at multiple levels of the stack.

Level 1 — HTML <picture> element (zero infrastructure needed)

hero.html HTML
<!-- Browser picks the first <source> it understands -->
<picture>
  <!-- AVIF: best compression, modern browsers -->
  <source srcset="hero.avif" type="image/avif">

  <!-- WebP: good compression, 95%+ browsers -->
  <source srcset="hero.webp" type="image/webp">

  <!-- JPEG: universal fallback for legacy browsers -->
  <img
    src="hero.jpg"
    alt="Hero image"
    width="1200"
    height="630"
    loading="lazy"
    decoding="async"
  >
</picture>

Level 2 — CDN / server-side Accept header negotiation (single URL, right format)

edge-function.ts Cloudflare / Vercel Edge
export default {
  async fetch(request) {
    const accept = request.headers.get('Accept') ?? '';
    const url = new URL(request.url);

    let format = 'jpeg'; // safe fallback
    if (accept.includes('image/avif')) format = 'avif';
    else if (accept.includes('image/webp')) format = 'webp';

    url.searchParams.set('fmt', format);
    return fetch(url.toString());
  }
};
imghosting.in

Level 3 — Fully Managed Format Delivery

Rather than managing format variants yourself, imghosting.in stores your original upload and serves the optimal format automatically based on the browser's Accept header—delivering AVIF to Chrome and Firefox, WebP to compatible browsers, and JPEG to legacy fallbacks, all from a single permanent CDN URL. The free tier includes 500 uploads/month at up to 20 MB per file; the premium plan starts at $2.49/month (3-year billing) for 10,000 uploads/month at up to 50 MB per file.

07 · Quality at the Edges

Where Each Format Breaks Down—And Why It Matters

Average benchmark numbers hide the edges. Here's where each format struggles and what that means for your content types.

W

WebP struggles with: extreme compression ratios

At very low bitrates (high-compression thumbnails or tiny avatars), WebP produces blockier artefacts than AVIF. The VP8 codec's block-based DCT quantisation becomes visible at small file sizes. If you're generating 5–10 KB thumbnails, test both formats—you may be surprised how much cleaner AVIF looks at the same byte count.

A

AVIF struggles with: sharp geometric edges and text in images

Ringing artefacts near high-contrast edges (white text on dark backgrounds, logos with sharp corners) are more pronounced in AVIF at equivalent compression. For screenshots, slides, or infographics with text, WebP lossless or even PNG may produce cleaner results at a reasonable file size.

!

Both formats struggle with: transparency over complex backgrounds

Transparent PNG edges (product cut-outs, logos with alpha) can look "dirty" when converted to lossy WebP or AVIF because codec noise bleeds into semi-transparent pixels. Use lossless WebP (-lossless) or AVIF lossless mode for transparency-critical images, or keep them as PNG if the file size is tolerable.

08 · FAQ

Frequently Asked Questions

Should I convert my existing JPEG/PNG library to AVIF today? +
Not all at once. Prioritise assets that are frequently fetched and large (hero images, product photography). Convert thumbnails and icons last—the byte savings are small and re-encoding risks introducing artefacts. Run both formats through a visual QA step (Squoosh or the Sharp preview) before mass-converting your CDN assets.
Does AVIF improve Google Core Web Vitals (LCP) scores? +
Yes—if the LCP element is an image. Smaller files = less data transferred = faster time to first byte displayed. In controlled tests, switching a 400 KB JPEG hero image to a 160 KB AVIF equivalent improved LCP by 0.3–0.6 s on a simulated 4G connection. The actual improvement depends heavily on your CDN edge locations, server response time, and how well the image is prioritised with fetchpriority="high".
Can I use AVIF for Open Graph (og:image) thumbnails? +
Not safely. Social platforms (Twitter/X, Facebook, LinkedIn, Slack, Discord) use server-side scrapers to fetch og:image URLs. These scrapers often don't support AVIF and will fall back to a broken image or display nothing. Always serve JPEG or PNG for og:image URLs regardless of what format you serve in the browser. Keep a separate JPEG copy of your OG images.
Is AVIF lossless practical for production use? +
AVIF lossless files are typically larger than PNG for most content, and encode extremely slowly (minutes per image). It is not recommended for production web delivery. Use WebP lossless instead, which achieves 20–30% better compression than PNG lossless with reasonable encoding times.
What's the best tool to batch-convert images to both formats? +
Sharp (Node.js) is the most popular production choice—it supports both formats, runs natively, and is well-maintained. For CLI workflows, FFmpeg (with libaom or libsvtav1 for AVIF, libwebp for WebP) handles bulk conversion easily. Squoosh is excellent for one-off visual quality comparison. For hosted pipelines, imghosting.in handles the entire conversion and delivery pipeline automatically.

Skip the conversion complexity

Upload once. Get AVIF, WebP, and JPEG—automatically.

imghosting.in stores your original and delivers the optimal format to every browser via a permanent CDN link—no conversion scripts, no <picture> juggling, no bandwidth surprises. Free tier: 500 uploads/month. Premium from $2.49/month.