Skip to main content
Comparison 20 min read

WebP vs AVIF vs JPEG XL: Which Format When?

Comprehensive comparison of modern image formats. Learn the strengths, weaknesses, browser support, and ideal use cases for WebP, AVIF, and JPEG XL.

By ImageGuide Team · Published January 19, 2026 · Read as Markdown · Updated October 17, 2026

Disclosure: ImageGuide is published by Sirv, an image CDN company. This guide mentions Sirv products. Read how we write these guides.

webpavifjpeg xlimage formatscomparisonformat selection

Quick answer

Compare WebP, AVIF, and JPEG XL using the same source images, dimensions, and acceptable visual quality. Include encoding time, required features, and the browsers and tools your users need. Use fallbacks where necessary; no format is the smallest or most suitable choice for every image.

Reference for this answer: MDN image format reference.

Quick Comparison

AspectWebPAVIFJPEG XL
CompressionGoodExcellentBest
Browser SupportCurrent major browsersCurrent major browsersSafari 17+ and Chrome 155+; check other clients
Encoding SpeedFastSlowMedium
AnimationYesYesYes
TransparencyYesYesYes
HDRNoYesYes
Lossless JPEGNoNoYes
MaturityMatureGrowingImplemented everywhere, enabled in Safari

Test all three on your own images: Press converts a folder to WebP, AVIF, or JPEG XL locally and lets you inspect each result against the original at 100%. It writes separate copies, so the source files remain untouched.

WebP

WebP was developed by Google and released in 2010. It’s based on VP8 video codec technology.

Strengths

Broad browser support: Check the browsers and embedded clients required by your audience.

Modest compression gains on photos: in our benchmark, 7% smaller than mozjpeg on photos at the same high-quality score, but 37% smaller on screenshots.

Fast encoding: Quick to generate on-the-fly.

Full feature set: Lossy, lossless, animation, and alpha transparency.

Mature ecosystem: Wide tooling support, well-documented.

Weaknesses

Not the best compression: in the same benchmark, AVIF needed about 32% fewer bytes than WebP on photos at high quality.

16,383×16,383 pixel limit: Can’t handle very large images.

No progressive loading: Images load top-to-bottom.

No HDR support: Limited to SDR content.

Best For

  • General web images
  • Sites needing maximum browser compatibility
  • Dynamic/on-the-fly image generation
  • Animated content (replacing GIF)
  • When encoding speed matters

WebP Quality Settings

QualityTypical Usevs JPEG
85-100High qualitySimilar to JPEG 90-100
75-84BalancedSimilar to JPEG 80-90
60-74CompressedSimilar to JPEG 65-80

Sample Implementation

<picture>
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Description">
</picture>

AVIF

AVIF (AV1 Image File Format) emerged from the AV1 video codec, developed by the Alliance for Open Media.

Strengths

Best lossy compression at web quality: 31% smaller than mozjpeg on photos and 50% smaller on screenshots at the same high-quality score in our benchmark.

HDR support: High dynamic range and wide color gamut (Rec. 2020).

Excellent gradient handling: Smooth gradients without banding.

Film grain synthesis: Can reconstruct grain at decode time for smaller files.

Client requirements: Check support for the specific AVIF features you need.

Weaknesses

Slow encoding: 10-100× slower than WebP/JPEG.

Limited max dimensions: Some implementations cap at 8K.

Slower decoding: More CPU-intensive to display.

Newer ecosystem: Less tooling maturity than WebP.

Large image decode: Very large AVIFs can be slow to render.

Best For

  • Hero images and key visuals
  • Photography portfolios
  • When file size is critical
  • HDR content
  • Modern browser audiences
  • Pre-generated static assets

AVIF Quality Settings

AVIF is more efficient—use lower numbers for equivalent quality:

QualityTypical Usevs JPEG Equivalent
75-90High qualityJPEG 90-100
60-74BalancedJPEG 80-90
45-59CompressedJPEG 65-80
30-44AggressiveJPEG 50-65

Sample Implementation

<picture>
  <source srcset="image.avif" type="image/avif">
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Description">
</picture>

JPEG XL

JPEG XL was developed by the JPEG committee, combining Google’s PIK and Cloudinary’s FUIF proposals.

Strengths

Best compression near lossless: in our benchmark it trailed AVIF at typical web quality (23% vs 31% smaller than mozjpeg on photos) but needed fewer bytes than AVIF at visually lossless quality.

Lossless JPEG transcoding: Can convert JPEG to JXL and back without quality loss.

Progressive decoding: Shows preview while loading.

Huge dimension support: Up to 1 billion × 1 billion pixels.

HDR and wide gamut: Full support for modern display technologies.

Responsive by design: Built-in support for multiple resolutions.

Weaknesses

Client support still needs checking: Safari 17 supports JPEG XL, and Chrome ships it from version 155. Older versions and other Chromium-based applications can differ, so keep a compatible fallback.

Tooling differs by workflow: Verify encoder availability, animation, HDR, and downstream editing support rather than treating the browser’s format decoder as end-to-end support.

Current Status

Chrome 145 reintroduced a decoder behind a flag; Chrome 155 is the later shipping milestone. See the updated Chrome report for the distinction. There is no universal format winner: compare your own content and delivery requirements.

Potential Use Cases (If Support Improves)

  • Archival and master files
  • Progressive image delivery
  • JPEG library migration (lossless conversion)
  • Very large images (gigapixel)

Head-to-Head Comparison

Compression Efficiency

Our Benchmark Lab encoded 86 images with each format at 14 quality settings, scored every result with SSIMULACRA2, and compared the bytes needed to reach the same score. Median file size against mozjpeg at score 70 (high quality):

Content (images)WebPAVIFJPEG XL
Photos (74)7% smaller31% smaller23% smaller
Screenshots (12)37% smaller50% smaller30% smaller

Medians for this corpus, measured in October 2026. Your images can differ.

Photo size at the same visual quality

Median per-image size against mozjpeg at SSIMULACRA2 70, 74 photos

Near visually lossless quality (score 90) the order changes: JPEG XL needed a median 2.22 bits per pixel on photos against 2.74 for AVIF, while WebP reached that score on only 9 of the 74 photos.

Encoding Speed

Time to encode a 4000×3000 image:

FormatEncoding TimeRelative
JPEG50 msBaseline
WebP100 ms2× slower
AVIF (speed 6)2000 ms40× slower
AVIF (speed 0)30000 ms600× slower
JPEG XL500 ms10× slower

AVIF speed setting dramatically affects encoding time

Encoding Time Comparison

Time to encode a single 1920×1080 image

Decoding Speed

Time to decode and render a 1920×1080 image:

FormatDecode TimeCPU Impact
JPEG10 msLow
WebP15 msLow
AVIF30 msMedium
JPEG XL20 msMedium

Feature Comparison

FeatureJPEGWebPAVIFJPEG XL
Lossy compression✓✓✓✓
Lossless compression✗✓✓✓
Alpha transparency✗✓✓✓
Animation✗✓✓✓
Progressive loading✓✗✗*✓
HDR✗✗✓✓
Wide gamutLimitedLimited✓✓
Max dimensions65K16K65K1B
Lossless JPEG convertN/A✗✗✓

*AVIF supports layered progressive loading but with limited implementation

Browser Support Deep Dive

Current support: verify the required clients

WebP and AVIF are supported in current major browsers. JPEG XL is supported in Safari 17 and Chrome 155. Check older browser versions, embedded web views, other browser releases, and the particular features you use before deployment.

An undated global percentage hides those distinctions. Use your own audience requirements and keep the fallback source working.

Fallback Strategy

Always provide fallbacks for older browsers:

<picture>
  <!-- Best compression, growing support -->
  <source srcset="image.avif" type="image/avif">
  <!-- Good compression, excellent support -->
  <source srcset="image.webp" type="image/webp">
  <!-- Universal fallback -->
  <img src="image.jpg" alt="Description">
</picture>

Decision Framework

Primary Format Selection

Do you need maximum browser support?
├── Yes → WebP primary, JPEG fallback
└── No → Is encoding speed critical (dynamic generation)?
    ├── Yes → WebP primary
    └── No → Do you need HDR?
        ├── Yes → AVIF primary
        └── No → Is file size critical?
            ├── Yes → AVIF primary
            └── No → WebP primary

Maximum Compatibility:

<picture>
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Description">
</picture>

Balanced (Most Sites):

<picture>
  <source srcset="image.avif" type="image/avif">
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Description">
</picture>

Maximum Compression:

<picture>
  <source srcset="image.avif" type="image/avif">
  <img src="image.jpg" alt="Description">
</picture>

Use Case Matrix

Use CaseRecommendedReasoning
General webWebP + AVIFBroad support + compression
E-commerce productsAVIF + WebPQuality matters, pre-generated
User uploadsWebPFast encoding, good compression
PhotographyAVIFBest quality, pre-generated
AnimationsWebPBest animation support
Hero imagesAVIFWorth the encoding time
ThumbnailsWebPFast generation, good enough
EmailJPEGUniversal support
CDN auto-formatAVIF → WebP → JPEGCDN handles complexity

Implementation Strategies

Static Site Generation

Pre-generate all formats during build:

const sharp = require('sharp');

async function generateFormats(input) {
  const base = input.replace(/\.[^.]+$/, '');

  await Promise.all([
    // AVIF (slow, do first for build caching)
    sharp(input).avif({ quality: 65 }).toFile(`${base}.avif`),
    // WebP
    sharp(input).webp({ quality: 80 }).toFile(`${base}.webp`),
    // JPEG fallback
    sharp(input).jpeg({ quality: 80 }).toFile(`${base}.jpg`)
  ]);
}

CDN/Image Service

Let the CDN handle format selection:

<!-- Sirv auto-selects best format -->
<img src="https://example.sirv.com/image.jpg?format=optimal" alt="">

<!-- Cloudinary -->
<img src="https://res.cloudinary.com/demo/image/upload/f_auto/image.jpg" alt="">

Server-Side Negotiation

Use Accept header to serve appropriate format:

# Nginx configuration
map $http_accept $img_suffix {
  default ".jpg";
  "~*avif" ".avif";
  "~*webp" ".webp";
}

location /images/ {
  try_files $uri$img_suffix $uri =404;
  add_header Vary Accept;
}

Quality Tuning

Equivalent Quality Settings

For similar visual quality across formats:

TargetJPEGWebPAVIF
High908575
Standard807565
Compressed706550
Aggressive605540

AVIF Encoding Optimization

# Balance quality and encoding time
avifenc --min 20 --max 40 --speed 6 input.png output.avif

# Maximum quality (slow)
avifenc --min 10 --max 30 --speed 0 input.png output.avif

# Fast encoding (lower compression)
avifenc --min 30 --max 50 --speed 9 input.png output.avif

Content-Specific Settings

ContentAVIF QualityWebP QualityNotes
Photographs60-7075-80Standard
Text overlays75-8585-90Preserve sharpness
Gradients70-8080-85AVIF excels
Detailed textures65-7580-85Balance quality/size
Product photos70-8080-85Quality matters

Migration Strategy

From JPEG-Only

  1. Audit current images: Identify largest and most-viewed
  2. Add WebP first: Maximum support, immediate gains
  3. Add AVIF second: Additional compression for modern browsers
  4. Use picture element: Maintain fallbacks
  5. Monitor metrics: Track bandwidth savings and Core Web Vitals

Sample Migration

Before:

<img src="product.jpg" alt="Product">

After:

<picture>
  <source srcset="product.avif" type="image/avif">
  <source srcset="product.webp" type="image/webp">
  <img src="product.jpg" alt="Product" width="800" height="600">
</picture>

The JPEG XL Question

Should You Wait for JPEG XL?

Arguments for waiting:

  • Technically superior format
  • Safari ships it, and Chrome and Firefox both re-implemented it in 2026
  • Lossless JPEG conversion is unique

Arguments against waiting:

  • Chrome and Firefox keep it off by default, so it reaches almost no real traffic
  • Neither vendor has announced a date for enabling the flag
  • AVIF covers most use cases

Recommendation: Use AVIF and WebP today. JPEG XL is now implemented in every major engine but enabled only in Safari, so monitor it and keep it out of your delivery path until Chrome flips its flag.

JPEG XL for Archival

Even without browser support, JPEG XL can be valuable:

# Losslessly convert JPEG to JXL (saves ~20%)
cjxl input.jpg output.jxl --lossless_jpeg=1

# Convert back to identical JPEG when needed
djxl output.jxl restored.jpg

This provides archival savings while maintaining the ability to serve JPEG.

Summary

Quick Recommendations

ScenarioFormat Stack
Most websitesAVIF → WebP → JPEG
Maximum compatibilityWebP → JPEG
Dynamic generationWebP → JPEG
Photography focusAVIF → JPEG
CDN-basedAuto-format (CDN handles)

Format Strengths at a Glance

  • WebP: Best balance of support and compression, mature ecosystem
  • AVIF: Best compression, HDR support, growing adoption
  • JPEG XL: Best technically, but limited browser support

Implementation Checklist

  1. ✅ Use picture element with format fallbacks
  2. ✅ Generate AVIF for pre-built static assets
  3. ✅ Use WebP for dynamic/real-time generation
  4. ✅ Always provide JPEG fallback
  5. ✅ Tune quality settings per format
  6. ✅ Consider CDN auto-format for simplicity
  7. ✅ Monitor browser support changes
  8. ✅ Test visual quality at your chosen settings

The format landscape continues to evolve. Today, the AVIF → WebP → JPEG stack provides the best combination of compression and compatibility for most websites.

Sources

Resize and deliver images with Sirv

Upload your images to Sirv, then request the sizes and formats your pages need.

Get started