Image Optimization: The 2026 Practical Guide

Images are usually the heaviest thing on a web page, which makes them the single biggest performance opportunity most sites are leaving on the table. Optimizing them well — the right format, the right size, delivered the right way — often cuts page weight in half and directly improves your Core Web Vitals.

The short version

Serve modern formats (AVIF or WebP) with a JPEG fallback, size images to how they actually display using srcset, lazy-load anything below the fold, compress sensibly, and always set width and height to prevent layout shift. Run a scan to see how heavy your images are.

1. Choose the right format

Format is the biggest lever. Match it to the kind of image:

FormatBest forNotes
AVIFPhotos, complex imagesSmallest files; excellent quality per byte
WebPPhotos, graphicsSmaller than JPEG/PNG; near-universal support
JPEGPhotos (fallback)Universal; use for older-browser fallback
PNGGraphics needing transparencyLossless but large; prefer WebP/AVIF where possible
SVGLogos, icons, line artVector, scales infinitely, tiny for simple shapes

Use the <picture> element to offer AVIF first, then WebP, then a JPEG fallback, letting each browser pick the best format it supports:

<picture>
  <source srcset="/img/hero.avif" type="image/avif">
  <source srcset="/img/hero.webp" type="image/webp">
  <img src="/img/hero.jpg" width="1200" height="675" alt="...">
</picture>

2. Serve responsive sizes with srcset

Sending a 2000-pixel image to a phone that displays it at 400 pixels wastes most of the download. Provide several sizes and let the browser choose based on the device with srcset and sizes:

<img src="/img/photo-800.webp"
     srcset="/img/photo-400.webp 400w, /img/photo-800.webp 800w, /img/photo-1600.webp 1600w"
     sizes="(max-width: 600px) 100vw, 800px"
     width="800" height="450" alt="...">

3. Lazy-load below the fold

Add loading="lazy" to images that start off-screen so the browser defers loading them until the user scrolls near. This frees bandwidth for what’s visible immediately. One critical exception: never lazy-load your LCP image — it should load as early as possible.

4. Compress sensibly

Most photos look identical at a moderate quality setting yet weigh far less than a maximum-quality export. Compress until you can just start to notice a difference, then step back one level. Strip unnecessary metadata, and for SVGs, run them through a minifier to remove editor cruft. Because images are already compressed, don’t run them through Gzip or Brotli — that only wastes CPU.

5. Set dimensions to protect CLS

Always include explicit width and height attributes, as shown in the examples above. They let the browser reserve the right amount of space before the image loads, preventing the page from jumping — a common and easily avoided cause of poor Cumulative Layout Shift.

Tip: Deliver images through a CDN. Beyond edge caching, many image CDNs can convert format, resize, and compress on the fly, so you upload one master file and each visitor receives an optimally sized version.

Frequently asked questions

Should I switch everything to AVIF?

AVIF gives the smallest files, but pair it with a WebP or JPEG fallback via the <picture> element so every browser is covered. That way you get the savings without breaking older clients.

Does lazy loading hurt SEO?

No, when done correctly. Use native loading="lazy" for below-the-fold images only, and keep your main content and LCP image eagerly loaded so crawlers and users see them right away.

What size should my images be?

No larger than the maximum size they display at, accounting for high-density screens. Use srcset to serve smaller versions to smaller devices rather than one oversized file to everyone.

Related guides

Check your site against this guide

Run a free ScanOpsPro scan and see how your site handles the fundamentals.

Run a free scan