Loading...
<img src="hero.avif"
alt="Mountain lake at dawn"><picture>
<source srcset="hero.avif" type="image/avif">
<img src="hero.jpg" alt="Mountain lake at dawn" width="1200" height="800">
</picture>The <picture> element lets browsers pick AVIF and fall back to JPEG, and the <img> keeps alt and size.
<picture> with a <source type='image/avif'> and a JPEG or WebP <img> fallback.Content-Type.<img> keeps alt, width and height, since the <source> only swaps the file.AVIF is usually smaller than WebP at the same visual quality, especially for photos. WebP encodes faster, so many sites serve AVIF first and WebP or JPEG as fallback.
Yes. AVIF supports an alpha channel, HDR, wide color gamut and animated image sequences.
AV1 compression does heavy analysis to find small encodings. Encode images at build time or cache the result instead of converting on every request.