跪拜 Guibai
← Back to the summary

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

From GIF to AVIF: Evolution of Web Image Formats and a 2026 Selection Guide

cover

When you drop an image into a web page, saving it as PNG might cost a few hundred KB, and screenshot tools often produce even larger outputs. Images usually account for the bulk of page traffic; picking the wrong format means making users pay several times more bandwidth for the same visual result. And the question "what format should I use?" gets reanswered every few years—at the point of November 2026, the answer is already different from three years ago.

This note uses MDN's Image file type and format guide as its basis, summarizes the pros and cons of six common formats—GIF, JPEG, PNG, SVG, WebP, AVIF—then uses the latest caniuse data to fill in the current browser support landscape, and finally gives selection advice you can copy directly.

1. Timeline of origins

Lining up common web image formats by first specification or first public release:

Format Birth date Corresponding event
GIF 1987-06-15 CompuServe's first GIF87a specification. Original spec
JPEG / JPG 1992-09-18 ITU approves JPEG compression standard T.81. ITU record
PNG 1996-10-01 PNG 1.0 becomes a W3C Recommendation; the format began forming in December 1994. PNG 1.0 spec
SVG 2001-09-04 SVG 1.0 becomes a W3C Recommendation, positioned as a vector graphics format. SVG 1.0 spec
WebP 2010-09-30 Google publicly releases the WebP developer preview. Chromium announcement
AVIF 2019-02-19 The Alliance for Open Media's AVIF 1.0 specification date. AVIF 1.0 spec

From GIF to AVIF spans 32 years; WebP came about eight and a half years before AVIF. Two patterns emerge from the timeline.

Pattern one: every new format sits on the pain points of the old era. GIF was born in 1987 when dial-up reigned; it only solved "getting the image across." JPEG used lossy compression to tame photo size. PNG was an open-source replacement forced by the LZW patent dispute (Unisys claimed fees in 1994), and incidentally added transparency. SVG turned "graphic description" from pixel grids to vectors. WebP and AVIF both come from video coding technology. WebP derives from Google's acquired VP8; AVIF comes from the Alliance for Open Media's AV1. The encoder's accumulated experience in intra-frame compression directly translates into static image compression advantages.

Pattern two: being born does not mean being usable; there is often a five-to-ten-year gap. WebP launched in 2010; Safari didn't support it until Safari 14 in 2020, a full ten years. AVIF was finalized in 2019; it took until Edge 121 in early 2024 to cover all evergreen browsers, about five years. So when evaluating a new format, looking only at the specification release date is meaningless; you need to track browser adoption. This is the standard used repeatedly below.

WebP and AVIF time span from release to key browser support

2. Walk through each format

GIF (1987): Universal compatibility, but time to retire

GIF uses LZW for lossless compression, but only supports 8-bit indexed color (max 256 colors), only 1-bit transparency (hard edges, no semi-transparency), and its animation lacks modern inter-frame compression. Its strength is that every browser that can display images knows it, plus meme culture keeps it alive and plentiful on the web.

But MDN's advice is direct: prefer PNG for static images, consider WebP, AVIF, or APNG for animation. A 10-second GIF animation converted to MP4/WebM video is usually an order of magnitude smaller. Today, still putting GIF on pages is usually out of habit, not because GIF is appropriate.

JPEG (1992): The baseline for photos

JPEG is actually JFIF container format with JPEG compression data, based on discrete cosine transform (DCT) for lossy compression: no transparency, no indexed color, only 8-bit true color, with a maximum dimension of 65,535×65,535 pixels.

In 2026, it is no longer the first choice for photos, but it remains the eternal fallback format. In any scenario where you don't know what the other side supports, JPEG is the greatest common divisor.

PNG (1996): The basic for lossless and transparency

PNG does lossless compression, supporting 1/2/4/8/16-bit grayscale, true color, and indexed color, with full alpha transparency and a maximum size of about 2.1 billion pixels.

Its positioning is clear: use it for screenshots and scenarios needing exact pixels; don't use it for photos.

SVG (2001): The only answer for vector graphics

SVG is an XML-based text format that stores graphics as geometry rather than pixels, allowing infinite scaling. It can be used as a standalone file via <img> or background-image, or inlined directly into HTML, and supports CSS and script control of style, animation, and interaction. After HTTP compression (gzip), transfer size is very small.

Icons, charts, diagrams—that's the default answer.

WebP (2010): The all-rounder after a ten-year marathon

WebP's lossy mode is based on VP8, on average 25%–35% smaller than JPEG; lossless mode is about 26% smaller than PNG; supports animation (ANIM/ANMF blocks) and alpha transparency.

It's the "safe default" today. When unsure what to use, WebP won't go wrong.

AVIF (2019): The new top student, safe to use starting 2026

AVIF comes from AV1's intra-frame coding, set by the Alliance for Open Media, royalty-free. Its compression rate is the strongest in its class: lossy mode is about 50% smaller than JPEG and beats WebP (MDN gives median data: AVIF ~50% compression, WebP ~30%). It also supports 10/12-bit color depth, HDR, wide gamut, YUV444, lossless compression, alpha transparency, animation, and grayscale.

First choice for photos and rich media images, with WebP/JPEG fallback.

Side note: APNG

Mozilla-led "animated PNG": lossless, true color, supported by all major browsers; looks and size are better than GIF, commonly used for stickers. But for compression size, animated WebP and animated AVIF are more efficient. APNG can be the direct upgrade path for GIF animations, but there's no reason to actively choose it in new projects.

3. Summary comparison

Format Compression Transparency Animation Color depth highlights Browser support (2026-11) One-line positioning
GIF Lossless (256-color indexed) 1-bit Yes 8-bit indexed All Old animation format, replace soon
JPEG Lossy No No 8-bit All Fallback and maximum compatibility
PNG Lossless Alpha No 16-bit All Screenshots and exact pixels
SVG Vector description Yes Yes Resolution-independent All Icons and charts
WebP Lossy + lossless Alpha Yes Lossy 8-bit All (completed 2020) Safe default
AVIF Lossy + lossless Alpha Yes 12-bit, HDR All evergreen (completed 2024) Photo first choice

4. Formats to stop using

MDN explicitly lists an "avoid" set, with crisp reasons:

5. How to choose at the 2026 node

Decision table by content type

Content type First choice Fallback
Photos AVIF WebP → JPEG
Icons / UI elements SVG PNG or lossless WebP
Screenshots Lossless WebP PNG
Charts / diagrams SVG PNG
Animation Video (MP4/WebM) or animated AVIF/WebP APNG

In MDN's table, the first choice for photos is written as "WebP or JPEG"—that's a conservative "maximum compatibility first" stance. If your traffic stats show legacy browsers are negligible (true for most sites in 2026), the first choice for photos should be upgraded to AVIF.

Fallback pattern

The <img> tag itself doesn't support format fallback; you need <picture> with multiple <source> elements:

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

Browser checks AVIF, then WebP, finally falls back to JPEG

The browser picks the first format it recognizes from the <source> order; <img> is the final fallback and carries width/height/alt. Don't skip these three attributes; they prevent layout shift and ensure accessibility. Two or three <source> elements are enough; more just wastes the build output.

2026's wildcard: JPEG XL

Outside the timeline, JPEG XL deserves special mention. The spec is set by the JPEG committee (ISO/IEC 18181, finalized 2022). Both lossy and lossless compression target AVIF and PNG's positions, and it uniformly supports progressive rendering and animation. It was once touted as the "ultimate image format." But its browser adoption has been extremely tortuous:

The current caniuse JPEG XL data gives about 54% global default support, 69% with partial support. Conclusion: JPEG XL is the variable most worth watching right now, but it's still far from "bare use." MDN's recommendation list hasn't included it yet. New projects don't need to adapt their pipeline for it; existing sites can keep an eye on it at the CDN layer, waiting for Edge and Safari to fill in before considering full migration.

Engineering-side convenient practices

My blog's approach

This blog itself is a reference sample: article covers uniformly use SVG vector images that adapt to the light/dark theme, and at build time generate WebP companion images for social sharing cards. Body screenshots are uniformly WebP. When distributing to platforms like WeChat that don't support WebP, they are converted to PNG/JPG in real time. The payoff of format selection isn't "how much a single image saves," but the accumulated traffic and storage savings of a site with several hundred images over a year.

Conclusion

When you get an image, ask three questions:

  1. Is it vector? (icons, charts, diagrams) → SVG;
  2. Is it a photo? → AVIF, with WebP/JPEG fallback;
  3. Other bitmaps (screenshots, exact pixels) → lossless WebP, with PNG as a safety net.

Finally, a lesson from the timeline: between a format's "birth" and "usable" often lies five to ten years. Watching browser adoption progress is more practical than watching compression-rate papers.

References