All Articles
PerformanceImagesSEO

WebP vs AVIF for WordPress: Which One Should You Actually Use

e
erdincbulat
June 10, 2026
6 min read
Erdo Image Optimizer

Two Formats, One Goal: Smaller Files

If you've looked into WordPress image optimization at all, you've run into both WebP and AVIF being recommended as JPEG replacements. They solve the same problem — smaller file sizes at equivalent visual quality — but they're not the same format, and picking the wrong one (or only one) leaves performance on the table.

This is the practical comparison: what each format actually gives you, where they fall short, and what to actually configure on a WordPress site.

WebP: The Safe Default

WebP has been around since 2010 and has near-universal browser support today, including Safari since version 14. At equivalent visual quality, WebP files run roughly 25-35% smaller than JPEG.

Strengths:

  • Extremely broad browser support
  • Fast to encode, even in bulk
  • Supports both lossy and lossless compression, plus transparency (replacing PNG)
  • Well supported by every major WordPress host and CDN

Limitations:

  • Not as small as AVIF can get
  • Lossless WebP files can sometimes be larger than a well-optimized JPEG

AVIF: Smaller, but Pickier

AVIF is the newer format, derived from the AV1 video codec. It generally produces noticeably smaller files than WebP at the same visual quality — often 50% smaller than the original JPEG.

Strengths:

  • Best-in-class compression — typically smaller than WebP at equal quality
  • Supports HDR and wide color gamut
  • Now supported by Chrome, Edge, Firefox, and Safari 16+

Limitations:

  • Slower to encode than WebP, which matters when bulk-converting a large media library
  • Slightly narrower browser support than WebP — a small percentage of visitors on older browsers won't get it
  • Some image editing and CDN tooling still has spottier AVIF support than WebP

The Real Answer: Serve Both, Automatically

Treating this as an either-or choice is the wrong framing. The correct approach for a production WordPress site is a fallback chain: serve AVIF to browsers that support it, WebP to browsers that support that but not AVIF, and the original JPEG/PNG to anything older.

This is done with the HTML <picture> element:

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

The browser checks each <source> in order and uses the first format it supports, falling back to the <img> tag's original file if none match. No JavaScript, no server-side user-agent sniffing — just standard HTML that every browser, including very old ones, understands.

How Erdo Image Optimizer Handles This

Manually generating and maintaining two extra copies of every image, plus writing the markup above for every <img> tag on your site, isn't realistic for most WordPress users. Erdo Image Optimizer automates the whole chain:

  1. On upload or bulk conversion, it generates both WebP and AVIF versions of each image using your server's own GD or Imagick library — no API key, no external service.
  2. On the frontend, it automatically rewrites <img> tags into <picture> elements with the correct source order, so visitors always get the smallest format their browser supports.
  3. AVIF is opt-in in settings, since encoding takes longer — you can enable it once your media library isn't actively growing, or leave WebP-only if your host has tight CPU limits.

This means you don't have to pick a side in the WebP vs. AVIF debate. The plugin generates both and lets the browser decide.

When to Skip AVIF

There are a couple of legitimate reasons to stick with WebP-only:

  • Very large media libraries on limited shared hosting. AVIF encoding is CPU-heavier; if your host throttles CPU time aggressively, bulk-converting tens of thousands of images to AVIF can take a long time to finish.
  • A meaningful share of your traffic comes from older Android devices or outdated browsers that don't support AVIF. WebP support is broader, so if your analytics show a long tail of legacy browsers, WebP alone still gets you most of the file-size benefit with less encoding overhead.

For most sites, neither of these applies, and enabling both formats is the right default.

Quick Reference

WebP AVIF
Avg. size vs. JPEG ~25-35% smaller ~50% smaller
Browser support Universal (incl. Safari 14+) Broad (Chrome, Edge, Firefox, Safari 16+)
Encoding speed Fast Slower
Best for Default for all sites Sites that can afford the extra encoding time for maximum savings

Wrapping Up

WebP vs. AVIF isn't really a competition — it's a fallback chain. Serve AVIF where supported, WebP as the safety net, and the original format as the last resort. If you're setting this up manually, the <picture> markup above gets you there. If you'd rather not maintain it by hand, Erdo Image Optimizer generates both formats and wires up the fallback automatically — free, with no API key, using your server's own image libraries. See our guide to converting WordPress images to WebP for the full setup walkthrough.

Free WordPress Plugin

Erdo Image Optimizer

WebP & AVIF conversion, auto alt text, lazy load and SEO audit — zero API key.

Frequently asked questions

More articles

ComplianceGDPR

GDPR vs. the EU Cyber Resilience Act: What WordPress Site Owners Need to Know

7 min read
SecurityCompliance

What Is security.txt and How to Add It to WordPress

5 min read