Image Optimization for SEO: WebP, AVIF, and Lazy Loading Done Right

The average web page is mostly images by weight. Getting them right is the highest-leverage speed work most sites can do, and most sites are doing at least one part wrong.

SP

SAT Team

7 min read

Strip any typical web page down to bytes and images dominate. HTTP Archive data has shown this for years: on a median page, images outweigh the HTML, CSS, and often the JavaScript. Which means if you only have time to optimize one thing, this is the thing.

The catch is that image optimization has grown from "compress your JPEGs" into a stack of decisions: format, sizing, loading strategy, priority hints. Get them all right and pages fly. Get one wrong, say, lazy-loading your hero image, and you've made things worse while feeling productive.

Let's go through the stack in the order that matters.

Pick the right format

AVIF is the current efficiency champion, commonly 30 to 50% smaller than an equivalent JPEG, with support in every major modern browser. WebP sits close behind, slightly larger files but universally supported and faster to encode. Classic JPEG remains the safe fallback, and PNG should be reserved for screenshots and graphics that need lossless detail. SVG wins for logos and icons, always.

The practical setup is the picture element: offer AVIF first, WebP second, JPEG as the fallback. Browsers pick the best one they understand. If that markup feels tedious, an image CDN (Cloudflare Images, Bunny, Cloudinary, imgix and friends) will negotiate formats automatically from a single URL, and honestly that's how most busy teams should do it.

One myth to kill: converting to WebP does not magically shrink a 4000-pixel photo into a sensible file. Format is only one lever. Dimensions are a bigger one.

Size images for the screen, not the camera

Shipping a 2400px-wide image into a 400px-wide slot wastes most of the bytes you send. The srcset and sizes attributes fix this: you provide the same image at several widths, describe how wide the slot renders, and the browser downloads the smallest file that looks sharp on that particular screen.

Generate 4 to 6 widths per image, something like 400, 800, 1200, 1600, 2000 pixels. Every serious CMS and framework automates this. WordPress does it out of the box; check that your theme actually outputs the markup instead of hardcoding the full-size original, because plenty of premium themes still do exactly that.

On compression: quality 75 to 82 is the sweet spot for photos. Below 70, artifacts creep in. Above 85, file size balloons for detail nobody perceives on a normal screen.

Lazy loading: powerful, and routinely misused

Native lazy loading is one attribute: loading="lazy". The browser defers the download until the image approaches the viewport. For a long article with thirty images, that's a massive bandwidth saving and a faster initial load.

Here's the mistake that undoes it all: lazy-loading above-the-fold images. Your hero, your logo, the first product photo. Mark those lazy and the browser politely delays the most important visual on the page. LCP tanks. This misconfiguration is everywhere, partly because some WordPress plugins slap loading="lazy" on every image without asking.

The rule is short: everything above the fold loads eagerly, and your main hero image gets fetchpriority="high" so the browser bumps it to the front of the queue. Everything below the fold gets loading="lazy". Audit this today; it takes ten minutes and it's one of the most common LCP problems on the entire web.

Also: always set width and height attributes, lazy or not. Without them, images that pop in cause layout shift, and there goes your CLS score.

The SEO layer people forget

Speed is half the story. Images also earn search traffic on their own, and Google needs signals to understand them:

Alt text describes the image for screen readers and crawlers alike. Write it like you'd describe the picture to someone on the phone: "woman repotting a monstera on a balcony," not "plant-img-final-v2" and not a keyword pileup. Decorative flourishes can take an empty alt attribute so assistive tech skips them.

File names are a small signal, but "blue-suede-chelsea-boots.avif" beats "IMG_8842.avif" and costs you nothing.

Image sitemaps or structured data help for image-heavy businesses. Product schema with image properties feeds Google Shopping surfaces and rich results.

Captions and surrounding text carry more weight than most people assume. Google reads the paragraph around an image to understand it, and users read captions at a far higher rate than body text. A one-line caption under a key image serves both audiences at once. Cheap win, almost always skipped.

One more habit worth building: whenever a page earns image-search traffic in Search Console, treat that as a signal to double down. Those images are already winning; give them better alt text, tighter compression and a caption, and they'll usually climb further.

And keep images on crawlable URLs. If your fancy gallery renders everything through blob URLs in JavaScript, image search can't index any of it.

A checklist you can run this week

  • Convert hero and product images to AVIF or WebP with JPEG fallbacks
  • Generate responsive sizes and verify srcset is actually in the HTML
  • Remove loading="lazy" from all above-the-fold images
  • Add fetchpriority="high" to the LCP image on key templates
  • Set width and height everywhere
  • Compress at quality ~80, re-run PageSpeed, compare
  • Rewrite alt text on your top 20 pages like a human describing a photo

Two traps that catch even careful teams

The CMS re-compressing your already-compressed images. You export a beautifully optimized 80KB hero from your image tool, upload it, and WordPress (or your DAM, or your ecommerce platform) generates its own derivative at higher quality settings, and the page actually serves a 240KB version. Always check what URL the live page requests and how big that specific file is in the network tab. Optimize the pipeline, not just the source file.

Background images in CSS for content that matters. CSS backgrounds can't use srcset, can't take fetchpriority, get discovered late (after the stylesheet), and are invisible to image search. They're fine for textures and decoration. For heroes, products, and anything you'd want indexed or painted fast, use a real img element and style around it. Many LCP problems on "modern" sites trace back to this one architectural habit.

None of this requires a redesign or a new stack. It's unglamorous work with very glamorous results: on image-heavy sites this checklist alone can cut page weight sharply and improve LCP. Few afternoons of work pay off that directly.

Check your own site in 30 seconds

Run a free SEO audit and see exactly where your pages stand on the issues covered in this article.

Run Free SEO Audit

Keep reading