Jake Archibald benchmarked both formats on photos, screenshots, and images with transparency. AVIF wins at lossy compression: JPEG XL photos are typically 15–25% larger at default effort, and the gap is wider for screenshots and transparency. JPEG XL is the clear winner for lossless. His web default is AVIF 4:4:4 at the highest effort you can afford, with the jixel encoder for JPEG XL worth a try.
JPEG XL vs AVIF for web use-cases
