WebP and AVIF: Modern Image Formats Explained
WebP and AVIF can shrink image files without obvious quality loss. Learn how they work, where they fit and how to offer fallbacks for older software.
JPEG and PNG have been around for a long time, and for good reason: they work nearly everywhere. But newer formats such as WebP and AVIF were designed to deliver similar visual quality in smaller files. For websites and apps, smaller images can mean faster loading and lower data use. Here is what you need to know before adding them to your toolkit.
Why newer formats exist
Images often make up a large share of the data a web page needs to load. Reducing their size, without making them look noticeably worse, helps pages feel quicker. Engineers developed newer compression methods that can often produce smaller files than older ones at comparable quality. WebP and AVIF are two of the most widely discussed options.
WebP in a nutshell
WebP supports both lossy and lossless compression, transparency, and animation. That makes it a flexible substitute for several older formats: JPEG for photographs, PNG for graphics with transparency, and GIF for simple animations.
It is supported by the major modern browsers and many design and image tools. Many teams adopt it as a practical middle step, since it often reduces file size compared with JPEG or PNG while remaining widely supported.
AVIF in a nutshell
AVIF is a newer format that can achieve strong compression, particularly for photographs and images with smooth gradients. It also supports transparency and high-quality color options. In many cases it produces smaller files than WebP or JPEG at similar visual quality.
The trade-offs can include slower encoding, which means exporting may take longer, and variable support across software. Support has been growing, but you should check your target browsers, apps, and tools before relying on it.
How to compare formats fairly
Results depend on the image. A detailed photograph compresses differently than a flat graphic. To compare formats, try this approach:
- Choose a few representative images from your project.
- Export each in JPEG or PNG, WebP, and AVIF at settings that look similar to the eye.
- Compare file sizes and inspect the images at full size, looking for blurring, banding in gradients, and artifacts around sharp edges.
- Test the images in the real environment where they will appear.
Trust your eyes and measurements instead of general claims.
Offer fallbacks
Because not every environment supports every format, a good practice on the web is to provide fallbacks. The HTML picture element lets you list several sources, so the browser picks the first one it can use. A typical order might be AVIF, then WebP, then JPEG or PNG. This lets modern browsers benefit from smaller files while older ones still display an image.
For email, documents, and print workflows, stick to widely supported formats such as JPEG and PNG unless you know the recipient's software handles newer ones.
Keep your masters
As always, keep high-quality originals. Export modern formats from the master, not from an already compressed file. Converting from one lossy format to another repeats compression and can reduce quality. For guidance on choosing between older, widely supported formats, see our comparison of SVG, PNG, and JPEG.
When to stay with the classics
- You need maximum compatibility, including older software
- You are delivering files to clients who may open them in unknown tools
- The workflow involves print or editing steps that do not handle the new formats well
- The size savings are too small to justify the extra complexity
Practical tips
- Automate conversion if you have many images, using build tools or image services you trust.
- Set size limits for hero images and thumbnails.
- Test on slow connections and older devices.
- Document the formats your team uses and why.
Frequently asked questions
Is WebP always smaller than JPEG? Often, but not always. It depends on the image and settings. Compare with your own files.
Can I use AVIF everywhere? Not yet in every tool. Check support in your target environments and keep fallbacks.
Do I need to give up PNG and JPEG? No. They remain reliable and compatible, and are often the right choice for delivery and sharing.