Table of contents8
Last year I audited a client’s WordPress site and the homepage took nine seconds to load. The owner was sure his hosting was the problem, and he was ready to pay for a bigger server. Then I looked at his images: a 4 MB JPEG hero photo, product shots of 2 MB each, and a slider full of uncompressed uploads. Images were almost 80% of the page weight. One afternoon of format changes later, the same page loaded in under three seconds. Nothing else changed.
I am Carlos Mendez, and I have spent more than a decade building and fixing WordPress sites. Image optimization is the fastest speed win I know, and the format you choose is where it starts.
If you worry about picking the wrong format — blurry photos, broken images in some browsers, pages that crawl — this guide is for you. I will explain WebP, AVIF, JPEG, and PNG in plain words, give you a concrete framework for which format fits which image, hand you copy-paste commands to convert your images today, and show you how to serve them on WordPress safely.
You do not need to be a developer for any of this. Every tool below is free, and each technical term is explained in plain words.
Here is what this guide covers:
- WebP, AVIF, JPEG, and PNG Explained in Plain Words
- The Real Numbers: How Much Smaller These Formats Really Are
- My Decision Framework: Which Format for Which Image
- Convert Your Images: Copy-Paste Commands That Just Work
- Serve Them on WordPress Safely (With Fallbacks)
- What I Personally Use on My Own Sites in 2026
- Frequently Asked Questions
- Final Thoughts
Ready? Let’s get started.

WebP, AVIF, JPEG, and PNG Explained in Plain Words
The first time someone told me to “just use AVIF,” I nodded and then searched what AVIF even was. If you are there right now, you are not behind. An image format is simply a recipe for storing picture data. Some recipes make big files, some make small ones, and the right choice can cut your page weight in half.
JPEG is the old workhorse. It has stored photos on the web since the 1990s, shrinking them with lossy compression — it throws away detail your eyes barely notice. But it is a 30-year-old recipe: its files are big compared to modern formats, and it cannot do transparency (the see-through parts of a logo).
PNG is the quality-first format. Its lossless compression keeps every pixel exactly as it was, which makes PNG perfect for screenshots with text and sharp graphics. The price? Enormous files. I have seen a single PNG screenshot outweigh an entire page of text and code.
WebP is Google’s modern answer. It was built to replace JPEG and PNG at once: lossy compression for photos, lossless for graphics, plus transparency. Every major browser has supported it for years. When I converted that client’s 4 MB hero photo to WebP, it dropped to about 900 KB with no visible difference.
AVIF is the newest option. It borrows technology from modern video streaming and squeezes photos even smaller than WebP. WordPress 6.5 added native AVIF support, which tells you it is no longer experimental. The trade-offs: converting takes longer, and a few very old browsers cannot display it.
The Real Numbers: How Much Smaller These Formats Really Are
I once told a client his site would get “way faster” after converting his images, without giving him numbers. He expected miracles, I delivered improvements, and we had an awkward call. Lesson learned: always lead with hard numbers.
Here is the one that matters: WebP at quality 80 is typically 25–50% smaller than a JPEG at similar visual quality, according to SpeedVitals’ WebP vs AVIF comparison. A 1 MB photo becomes 500–750 KB. Do that across twenty images and you have removed megabytes of page weight.
AVIF goes further. In test after test it produces the smallest files of the three on most photographs — often visibly smaller than WebP at the same quality. I will not quote a fake exact percentage, since results vary by image, but in my own conversions AVIF hero photos regularly land 20–30% smaller than their WebP versions.
| Format | File size vs JPEG | Best for | Watch out for | |—|—|—|—| | JPEG | Baseline (100%) | Maximum compatibility | Huge files, no transparency | | PNG | Often larger than JPEG | Screenshots, sharp graphics, text | Very heavy for photos | | WebP | 25–50% smaller than JPEG | Almost everything | Nothing — the safe default | | AVIF | Smaller than WebP on most photos | Hero images, big photo galleries | Slower to convert, needs a fallback for very old browsers |
On browser support: WebP works in every modern browser, and AVIF works in all current browsers too. Google recommends WebP and AVIF in PageSpeed Insights when your images use older formats. The only risk is visitors on ancient browsers, and the fallback markup I show you later handles them automatically.
On that nine-second client site, converting everything to WebP removed about 60% of the total page weight. No design changes, no new hosting, no caching plugin. Just formats.

Now the practical question: which format for which image? That is what the framework below answers.
My Decision Framework: Which Format for Which Image
When I trained a junior colleague on image formats, I did not give him a lecture — I gave him five rules. He has never asked me about formats since. Here they are, and I use the same rules on my own sites.
If your image is a photograph, use AVIF first, WebP second. Photos are what these formats were built for. Serve AVIF with a WebP fallback and you get the smallest files with zero risk. Hero images, featured images, product photos — this one rule covers most images on most sites.
If your image needs transparency, use WebP or AVIF — never JPEG. JPEG cannot do transparent backgrounds, so a logo saved as JPEG gets an ugly white box. WebP and AVIF both handle transparency beautifully. PNG works too, but it will be much heavier.
If your image is a screenshot with text, use WebP lossless or PNG. Screenshots have sharp edges and tiny text, and lossy compression turns them to mush. I learned this the hard way when a tutorial screenshot’s menu text became unreadable. WebP lossless gives you PNG-level sharpness at a smaller size.
If your image is a logo with flat colors, use SVG — or WebP lossless. Vector logos are tiny and razor-sharp at any size. If SVG is not an option, WebP lossless is the answer. Never use JPEG for logos. Never.
If maximum compatibility keeps you up at night, choose WebP. Years of universal browser support, native WordPress handling, and every image tool reads and writes it. AVIF wins on file size, but WebP is the format you will never have to think about.
Pick one strategy and apply it consistently — mine is AVIF with WebP fallback for photos, WebP lossless for graphics. Consistency makes your media library predictable, and predictable is fast to maintain. Now let me show you the actual conversion commands I use every week.
Convert Your Images: Copy-Paste Commands That Just Work
Google’s `cwebp` tool comes with the free WebP codec package — most systems install it with one package-manager command. This one line converts a JPEG to WebP at quality 80:
“` cwebp -q 80 input.jpg -o output.webp “`
The `-q 80` is the quality setting, and 80 is my sweet spot. I tested 60 through 90 on the same photos: 80 is where file size drops sharply with no visible change. Below 70 you start seeing ugly artifacts in smooth areas like skies.
For a whole folder at once:
“` for f in *.jpg; do cwebp -q 80 “$f” -o “${f%.jpg}.webp”; done “`
For graphics that need perfect sharpness, use lossless mode:
“` cwebp -lossless screenshot.png -o screenshot.webp “`
For AVIF, the free `avifenc` tool (part of libavif) does the job:
“` avifenc –min 0 –max 63 input.jpg output.avif “`
Those quality numbers give roughly high-quality JPEG equivalence. Warning: this command is slow — ten to twenty times slower than the WebP equivalent, though you only run it once per image. Use it on your biggest hero images where the savings matter most, not on every thumbnail.
If the command line scares you, use Squoosh instead — a free web tool from the web.dev team. Drag in an image, pick WebP or AVIF, and watch the file size drop in real time. I use it for one-off images, and it is a great way to *see* the quality difference before converting a whole library.
Bonus Tip: Always convert copies, never your originals. I keep an `originals` folder for every site — re-downloading from a client is never fun.
Once converted, you need to serve them correctly on WordPress. That is next, and it is easier than you think.
Serve Them on WordPress Safely (With Fallbacks)
Even with perfect WebP and AVIF files on your server, every visitor must actually see them — including the rare one on an old browser. Good news: WordPress 6.5 and newer handle AVIF natively, and WebP has worked since WordPress 5.8. You upload them to the Media Library exactly like JPEGs.
If you want to squeeze every kilobyte out of your images beyond formats, read my guide on how to compress images in WordPress without losing quality.
The bulletproof pattern for serving AVIF with automatic fallbacks is the HTML `<picture>` element. Think of it as a bouncer: it offers the browser the best format first and falls back gracefully:
“`html <picture> <source srcset=”hero.avif” type=”image/avif”> <source srcset=”hero.webp” type=”image/webp”> <img src=”hero.jpg” alt=”A descriptive sentence about this photo”> </picture> “`
The browser tries AVIF first, then WebP, then the original JPEG. Nobody ever sees a broken image. That is the whole trick, and it is why browser support should not scare you.
On that nine-second site, the trickiest part was a theme that hardcoded JPEG URLs into its template. I replaced them with the fallback pattern above, and the remaining old-browser visitors got JPEGs while everyone else got AVIF. Two hours of work, nobody left behind.

Note: a few page builders and old plugins strip the `<picture>` element down to a plain `<img>`. If your AVIF version never appears, check that your builder is not removing the markup — pasting the pattern in a Custom HTML block usually survives.
Now that serving is solved, here is my honest setup — the one running on this very site.
What I Personally Use on My Own Sites in 2026
I wrote this guide from experience, so here is exactly what I run on my own sites — no theory, just practice. My photography-heavy client sites serve AVIF with WebP and JPEG fallbacks, and the bandwidth bills show it.
Hero and featured images get AVIF with WebP and JPEG fallbacks. These are the biggest files on the page, so they deserve the best compression. The `<picture>` fallback above does the heavy lifting, and old browsers get JPEGs automatically.
All other in-content images get WebP. For body images, galleries, and screenshots, WebP is the sweet spot: 25–50% smaller than JPEG with zero drama. I convert at quality 80 lossy for photos and lossless for sharp graphics.
Logos and icons live as SVG or WebP lossless. SVGs for anything vector (logos, icons), WebP lossless for anything raster with flat colors. JPEG never touches a logo on my sites.
My plugin stack is deliberately small: a good image optimizer plugin that auto-generates WebP versions on upload, plus short pixel’s CDN for the heaviest photography sites. For everything else, the theme templates already use the fallback pattern, and the Modern Image Formats plugin keeps the pipeline humming.

Frequently Asked Questions
Do I really need both WebP and AVIF? Strictly? No. WebP alone is an excellent setup. AVIF is for the perfectionists who want the absolute smallest files. The rule of thumb: if your images are most of your page weight, AVIF is worth the conversion time. If not, WebP everywhere is fine.
Will AVIF images break in old browsers? Not with the `<picture>` pattern above — old browsers simply get the JPEG. Without fallbacks, very old browsers show broken images. So: always ship fallbacks with AVIF. For WebP you barely need to worry, since support is universal.
Is converting to AVIF worth the time it takes? For hero images and large photos, yes — the file-size savings are real. But avifenc is slow: ten to twenty times slower than cwebp. My rule: AVIF for the big images that matter, WebP for everything else.
Can I use AVIF in WordPress? Yes — WordPress 6.5 added native AVIF support, so you can upload AVIF files to the Media Library like any other image. You still need the fallback markup for old browsers, but WordPress itself handles AVIF files fine.
What quality setting should I use? Quality 80 for WebP is my sweet spot: much smaller files with no visible change. Below 70, artifacts start showing in skies and gradients. For lossless graphics (screenshots, logos), skip the quality question entirely and use lossless mode.
Final Thoughts
That client’s site taught me that image formats are the fastest speed win in WordPress. Nine seconds to under three, from format changes alone. If you remember nothing else from this guide, remember this: photos get AVIF with WebP fallbacks, graphics get WebP lossless, and JPEG is for compatibility only.
Start today: convert your five largest images to WebP with the one-line command above, upload them, and check your page speed. Then come back for the rest. Your visitors — and your bandwidth bill — will thank you.
And if you want to go further, my image compression guide covers the rest of the pipeline: resizing, lazy loading, and the plugin stack that makes it all automatic.
For a deeper look at how formats affect your overall speed strategy, see my guide on WordPress speed optimization for 2026.
Happy converting! Related reading: is your WordPress theme slowing you down, plugin mistakes that slow WordPress, the WordPress speed battleground, object caching with Redis and Memcached, and shared versus managed WordPress hosting.











2 comments