Urgent.News

What's breaking now, across hundreds of outlets.

Tech

JPEG XL vs AVIF for web use-cases

As of now, JPEG XL has been integrated into all major web browsers, prompting the author to compare its performance against AVIF and other formats. For lossy photos on the web, AVIF consistently generates smaller files than JPEG XL. At default settings, JPEG XL tends to be 15-25% larger than AVIF; however, this gap shrinks to 6-20% at maximum effort settings.

There are exceptions where JPEG XL matches or even surpasses AVIF, particularly for specific images. The JPEG XL encoder plays a crucial role in file size, with the newer jixel encoder often producing smaller files than the older libjxl, except when dealing with detailed transparency. For screenshots and illustrations, AVIF generally outperforms JPEG XL, resulting in files that are 30-90% smaller at default effort settings and 20-70% smaller at maximum effort settings.

Lossy AVIF handles these cases well without the need for lossless formats unless absolute bit-exact results are required. Transparency is another area where AVIF shines over JPEG XL; the libjxl version is 31-44% larger at default effort settings and 61-70% larger at maximum effort settings compared to AVIF. AVIF encodes transparency losslessly, making its files about 2-3 times smaller than libjxl's.

AVIF also edges out JPEG XL in terms of encoding speed and memory usage, although jixel encodes faster and uses less memory. However, jixel's files are typically significantly larger, making AVIF the better choice overall. AVIF also decodes faster than JPEG XL, with the gap narrowing at very high qualities. Higher effort settings can make AVIF and jixel more appealing, but libjxl's higher efforts are noticeably slower and use more memory, sometimes resulting in larger files.

For images with transparency, AVIF is much smaller than JPEG XL, especially with libjxl that is 2-3x the size. AVIF also tends to be faster to encode and decode, with progressive rendering currently available in Chrome and in development for Firefox. AVIF's 4:2:0 mode, which reduces color resolution, rarely results in smaller files and complicates higher quality outcomes, except for faster encoding and decoding.

Progressive JPEG XL is available at higher effort levels, with recent support in jixel offering near-instant previews, albeit with a slight file size increase. AVIF also supports progressive rendering, offering more control and smaller, faster-decoding files, although Safari currently only renders the final image. For HDR content, JPEG XL lacks gain maps, a significant limitation compared to AVIF.

The author notes that JPEG XL can reduce existing JPEG files by 9-20% in size without further loss, and is as fast or faster to decode than AVIF, except for small images. For lossless images, JPEG XL clearly outperforms both AVIF and WebP, being smaller by 9-20% for photos and significantly smaller for other types, except for small images where jixel may produce slower decoding times.

Animated image formats are generally discouraged for web use. For web use-cases, the author recommends starting with AVIF 4:4:4 at the highest feasible effort level, but to switch to JPEG XL via jixel if AVIF proves too large. Both AVIF and JPEG XL (through jixel) have seen significant improvements, but the author encourages testing with one's own images.

While some suggest JPEG XL is technically limited compared to AVIF, the focus here is on the results with current implementations. The author created a benchmarking script to encode images using various codecs at different settings and record various metrics. The tests used images with a width of 1598 pixels, which is twice the maximum width most images on the blog appear at, ensuring sharpness on high-density displays.

The benchmarking was conducted on a 2024 MacBook Pro (M4 Pro). When the author first wrote about AVIF, they used an F1 car as a test image, so they continued with that image in this article.

Rewritten by urgent.news; may contain errors — check the original.

Source: jakearchibald.com

Read the original at jakearchibald.com →

Report a problem with this story

More in Tech

More from Thursday, 15 October 2026 →