跪拜 Guibai
← All articles
Frontend · Architecture

The 2026 Web Image Format Cheat Sheet: AVIF Takes Over, JPEG XL Waits

By 王若风 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Serving AVIF instead of JPEG can cut photo bytes roughly in half, and every evergreen browser now supports it, so the switch is payoff without a compatibility tax. The remaining variable is JPEG XL, whose browser politics mean waiting for Edge and Safari before planning a migration.

Summary

Image files dominate page weight, and the format you choose can multiply or halve traffic. This guide walks through six formats from GIF to AVIF, using MDN's reference and caniuse data as of November 2026. It tracks each format's history, strengths, and weaknesses, and shows that browser adoption lags spec release by five to ten years: WebP took a decade to reach Safari, AVIF five years to cover all evergreen browsers.

The article gives a decision table: photos go to AVIF with WebP/JPEG fallback; icons and charts to SVG; screenshots to lossless WebP; animations to video or animated AVIF/WebP. It also warns against BMP, ICO, TIFF, and XBM. Engineering advice includes generating multiple formats at build time (e.g., Astro's sharp-based pipeline) and using CDN content negotiation via the Accept header. JPEG XL now has default support in Chrome 155, Firefox 158, and Opera 139, but Edge remains unsupported and Safari only partial, so it's not yet ready for default use.

Takeaways
— AVIF is about 50% smaller than JPEG for lossy photos; WebP averages 25–35% smaller than JPEG, and WebP's lossless mode is about 26% smaller than PNG.
— Browser support for AVIF completed with Edge 121 in early 2024; WebP reached Safari 14 in 2020 after a ten-year wait.
— MDN's avoid list: BMP (no compression), ICO (use PNG favicon), TIFF (not browser-friendly), XBM (deprecated and insecure).
— Decision table: photos -> AVIF with WebP/JPEG fallback; icons/UI -> SVG; screenshots -> lossless WebP; charts/diagrams -> SVG; animations -> video (MP4/WebM) or animated AVIF/WebP, with APNG as fallback.
— Use `<picture>` with `<source>` order AVIF, WebP, then `<img src="photo.jpg">` for fallback; include width, height, and alt to prevent layout shift and support accessibility.
— As of November 2026, JPEG XL has about 54% global default support (69% including partial); Chrome 155, Firefox 158, and Opera 139 enable it by default; Edge 156 has none, Safari 17+ only static images.
— Build-time multi-format generation (e.g., Astro with sharp) and CDN Accept-Header negotiation are the low-effort ways to deploy AVIF without rewriting markup.
— AVIF lacks progressive rendering; large images appear suddenly on weak networks, so test above-the-fold images against progressive JPEG.
Conclusions

Spec release dates matter less than browser adoption curves; WebP took a decade to reach Safari and AVIF five years to cover all evergreen browsers, so a format's practical viability is set by release cycles, not protocol dates.

MDN's reference still recommends WebP or JPEG as the default for photos, but that conservative stance is outdated for 2026; the article's decision table upgrades to AVIF once legacy browser share is negligible, which is true for most sites.

JPEG XL's support history is a reminder that technical superiority can lose to browser politics: Chrome removed its experimental support in 2023, restored it by default in 155, while Edge remains entirely unsupported and Safari only partially, making it a watch-and-wait format.

The biggest practical win from a format pipeline is cumulative; a site with hundreds of images saves more in a year from AVIF's 50% compression than from any per-image micro-optimization.

Concepts & terms
AVIF (AV1 Image File Format)
A royalty-free image format using AV1 intra-frame compression, supporting 10/12-bit color, HDR, wide gamut, lossless, and alpha. It delivers roughly 50% smaller files than JPEG and is now supported in all evergreen browsers.
WebP
Google's image format based on VP8, with both lossy and lossless modes, animation, and alpha. Lossy WebP averages 25–35% smaller than JPEG; lossless is about 26% smaller than PNG.
JPEG XL
A next-generation format from the JPEG committee (ISO/IEC 18181, 2022) aiming to beat AVIF and PNG in both lossy and lossless compression, with progressive rendering and animation. Browser support remains partial as of late 2026.
Progressive rendering
A loading mode where an image displays a low-quality approximation first and gradually sharpens; JPEG and JPEG XL support it, while AVIF does not, affecting perceived performance on slow connections.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗