---
title: "Optimize Website Images to Speed Up Pages and Rank in Image Search"
description: "Pick WebP or AVIF, compress and resize, serve responsive images, lazy-load the right ones, and fix the LCP and CLS problems that images cause."
canonical: "https://scalewithsearch.com/articles/image-optimization-ux-seo"
date: "2026-03-20"
modified: "2026-11-10"
---
## Site navigation

- [Scale With Search](https://scalewithsearch.com/)
- Services
  - Local
    - [All services](https://scalewithsearch.com/services)
    - [AI visibility tracking](https://scalewithsearch.com/services/ai-visibility-tracking)
    - [Google Maps rank tracking](https://scalewithsearch.com/services/google-maps-rank-tracking)
    - [Local SEO](https://scalewithsearch.com/services/local-seo)
    - [Google Business Profile management](https://scalewithsearch.com/services/google-business-profile)
  - Website and search
    - [SEO solutions](https://scalewithsearch.com/seo)
    - [Technical SEO](https://scalewithsearch.com/seo/technical-seo)
    - [On-page and content SEO](https://scalewithsearch.com/seo/on-page-and-content-seo)
    - [Semantic SEO and topical authority](https://scalewithsearch.com/seo/semantic-seo-and-topical-authority)
    - [Custom SEO tools](https://scalewithsearch.com/seo/custom-seo-tools)
    - [Site build](https://scalewithsearch.com/work#site-build)
    - [Whole website fix](https://scalewithsearch.com/work#whole-website-fix)
  - AI functions
    - [AI operations](https://scalewithsearch.com/ai-systems)
  - First step
    - [Working session](https://scalewithsearch.com/audit)
  - Start here
    - [Send your brief](https://scalewithsearch.com/work#send-your-brief)
    - [Example scope](https://scalewithsearch.com/work#review-the-example-scope)
    - [Prices and terms](https://scalewithsearch.com/work#prices-and-terms)
- Industries
  - Agencies
    - [SEO agencies and consultants](https://scalewithsearch.com/for/seo-agencies-and-consultants)
    - [Marketing agencies and freelancers](https://scalewithsearch.com/for/marketing-agencies-and-freelancers)
    - [AI visibility check for SEO agencies](https://scalewithsearch.com/check/seo-agencies-and-consultants)
    - [Marketing and SEO agencies](https://scalewithsearch.com/for/#group-agencies)
  - Browse by business
    - [Trades and field service](https://scalewithsearch.com/for/#group-trades)
    - [Real estate agents and teams](https://scalewithsearch.com/for/real-estate)
    - [Health, wellness, and animal care](https://scalewithsearch.com/for/#group-practices)
    - [Chiropractic and wellness practices](https://scalewithsearch.com/for/chiropractic-and-wellness-practices)
    - [Law, finance, and IT](https://scalewithsearch.com/for/#group-professional)
    - [Machine shops and manufacturers](https://scalewithsearch.com/for/#group-manufacturing)
    - [Restaurants, shops, studios, and nonprofits](https://scalewithsearch.com/for/#group-local-services)
  - [All industries](https://scalewithsearch.com/for/)
- Resources
  - Free tools
    - [AI visibility check](https://scalewithsearch.com/check)
    - [All free tools](https://scalewithsearch.com/tools/)
    - [Free starter kit (.zip)](https://scalewithsearch.com/kit/business-memory-starter-kit.zip)
  - Guides
    - [AI-native library](https://scalewithsearch.com/ai-native)
    - [Industry intelligence](https://scalewithsearch.com/intelligence)
    - [Office job guides](https://scalewithsearch.com/guides/)
    - [Business memory](https://scalewithsearch.com/articles/business-memory-for-ai-agents-guide)
    - [Agent governance](https://scalewithsearch.com/articles/ai-agent-governance-guide-small-business)
    - [Ownership and migration](https://scalewithsearch.com/articles/leaving-vendor-ai-memory-guide)
  - Articles
    - [All articles](https://scalewithsearch.com/articles/)
- About
  - Evidence
    - [Proof](https://scalewithsearch.com/proof)
  - Scale With Search
    - [About](https://scalewithsearch.com/about)
    - [How it works](https://scalewithsearch.com/how-it-works)

# Optimize Website Images to Speed Up Pages and Rank in Image Search.

Built from 4 notes in Victor's vault. Drafted with Claude Opus 5.5 and Claude Fable 5.1, rewritten against Victor's notes with Claude Opus 5.5. Reviewed by Victor on 2026.11.11.

A contractor uploads a new hero photo straight from the camera. The file is 6,000 pixels wide and several megabytes. On a phone over a mobile network, the page shows a blank space for seconds. Then the photo appears and pushes the text down the screen. PageSpeed Insights now reports a poor Largest Contentful Paint and a poor Cumulative Layout Shift.

Images are often the heaviest files on a page. The largest image above the fold is often the element that sets Largest Contentful Paint (LCP). An image with no reserved space causes layout shift. A good image also brings traffic from Google Images, but only if Google can find it and understand it.

## Measure before you change anything

Start with one template, such as the homepage or a product page. Run it in PageSpeed Insights and write down four things:

1. The LCP time and the LCP element. The report names the element. If it is an image, that image is your first target.
2. The Cumulative Layout Shift (CLS) score and the elements that shift.
3. The image audits: "Properly size images", "Serve images in next-gen formats", "Efficiently encode images", and "Defer offscreen images".
4. The total image bytes in the network summary.

Next, open Chrome DevTools, select the `Network` tab, and filter by `Img`. Sort by size. The largest files are usually the fastest wins. The [Core Web Vitals developer guide](/articles/#cluster-seo-by-role)<!-- reading-origin:XSgvYXJ0aWNsZXMvY29yZS13ZWItdml0YWxzLWRldmVsb3Blci1ndWlkZSk= --> explains how field data and lab data differ, so you know which numbers to trust.

At Grey Matter I ran this check with Lighthouse and GTmetrix across client sites. On one industrial distributor's site, mobile performance scored 6 out of 100. Mobile layout shift measured 0.447, more than four times the 0.1 limit. The causes were plain. PNG and JPG files took 1 to 1.5 seconds to answer from the server, and assets below the fold loaded at once.

A tool lists the errors. It does not tell you which fix matters for your business. Read the report, then decide the order yourself.

## Choose the format for each image

Use the format that fits the content:

| Format | Use it for | Notes |
|---|---|---|
| AVIF | Photos and complex images | Usually the smallest files at a given visual quality. Encoding is slower. |
| WebP | Photos and graphics, and the fallback when AVIF is not available | Smaller than JPEG and PNG at similar quality. Supports transparency. |
| JPEG | Final fallback for photos | Universal support. Larger files. |
| PNG | Screenshots and graphics that need exact pixels or transparency, when WebP is not possible | Lossless, often large. |
| SVG | Logos, icons, and simple illustrations | Vector, scales to any size. Minify it and remove editor metadata. |

As of 2024, current versions of Chrome, Edge, Firefox, and Safari all display WebP and AVIF. Keep a JPEG or PNG fallback for older browsers and for tools that cannot read the new formats.

Google Search publishes the list of image formats it indexes in its image SEO documentation. JPEG, PNG, WebP, GIF, and SVG are on that list. In August 2024, Google added AVIF to the list, for Google Images and other places that show images in Google Search.

Serve the best format that each browser accepts with the `<picture>` element:

```html
<picture>
  <source type="image/avif" srcset="/img/roof-crew-1600.avif">
  <source type="image/webp" srcset="/img/roof-crew-1600.webp">
  <img src="/img/roof-crew-1600.jpg" alt="Roofing crew installing architectural shingles on a two-story house" width="1600" height="1067">
</picture>
```

The browser takes the first `<source>` it supports. The `<img>` element supplies the fallback, the alt text, and the dimensions.

## Resize and compress

### Resize to the largest size you display

Never send a 6,000-pixel image to a slot that displays at 800 pixels. Find the largest width the image ever displays, across all breakpoints, and multiply by 2 for high-density screens. That is the largest file you need. A full-width hero on a desktop layout rarely needs more than 2,400 pixels.

### Compress with a quality setting, then look

Lossy compression removes detail the eye does not notice. A quality setting between 70 and 85 is a common starting point for JPEG and WebP. AVIF often looks the same at a lower number. Do not trust a number alone. Compare the output with the original at 100 percent zoom, and check skin tones, text, and fine patterns.

Use a tool that you can repeat:

- Squoosh for single images and side-by-side comparison.
- `sharp` in Node.js, or ImageMagick, in a build script.
- `cwebp` and `avifenc` on the command line.

Strip metadata such as camera data and embedded thumbnails unless you need it. The photo keeps its look and loses bytes.

### Automate it

Manual compression fails the first time someone uploads a photo in a hurry. Put the work in the pipeline. Most frameworks and CMS platforms offer an image component or plugin that resizes and converts on upload or at build time. An image CDN such as Cloudinary, imgix, or Cloudflare Images can resize, convert, and cache on request. The [CDN configuration guide](/articles/cdn-configuration-seo) covers cache headers for those files.

Speed is a shared job. The designer keeps load weight low. The developer keeps scripts and styles lean. When I could not touch a client's CMS, I wrote the image steps out for their developers, so the fix did not depend on my access.

## Serve responsive images

A phone and a desktop need different files. Give the browser a set of widths with `srcset`, and tell it the display size with `sizes`:

```html
<img
  src="/img/kitchen-1024.jpg"
  srcset="/img/kitchen-640.jpg 640w,
          /img/kitchen-1024.jpg 1024w,
          /img/kitchen-1600.jpg 1600w,
          /img/kitchen-2400.jpg 2400w"
  sizes="(max-width: 768px) 100vw, 50vw"
  alt="Renovated kitchen with white shaker cabinets and a quartz island"
  width="1600" height="1067">
```

The `w` value is the real pixel width of each file. The `sizes` value says the image fills the screen width on small screens and half of it on larger ones. The browser then picks the smallest file that looks sharp on that device. Combine `srcset` with `<picture>` to serve responsive AVIF and WebP files.

## Fix the Core Web Vitals problems

### Largest Contentful Paint

If the LCP element is an image, make that image arrive early:

1. Do not lazy-load it. Remove `loading="lazy"` from any image above the fold.
2. Mark it as high priority with `fetchpriority="high"`. Browsers that do not support the attribute ignore it.
3. Put it in the HTML as an `<img>`. Do not load it from JavaScript or from a CSS background, because the browser finds those late.
4. Resize and compress it with the rules above.
5. Serve it from your own domain or a fast CDN, with long cache headers.

```html
<img src="/img/hero-1600.webp" fetchpriority="high" alt="..." width="1600" height="900">
```

If the image is chosen by CSS or JavaScript and cannot move into the HTML, preload it:

```html
<link rel="preload" as="image" href="/img/hero-1600.webp" fetchpriority="high">
```

LCP must be 2.5 seconds or less for a good score.

### Cumulative Layout Shift

An image with no size makes the page jump when it loads. Always set `width` and `height` on `<img>`. The browser uses the ratio to reserve the space before the file arrives. For a flexible layout, keep the attributes and let CSS scale the image:

```css
img {
  max-width: 100%;
  height: auto;
}
```

For containers, `aspect-ratio` in CSS does the same job. CLS must be 0.1 or less for a good score.

### Interaction to Next Paint

Images rarely cause poor Interaction to Next Paint (INP) directly. Heavy carousels and scripts that decode many large images can. Keep carousel scripts light, and load each slide after the first only when it is needed.

## Lazy-load the right images

Native lazy loading defers images until the user scrolls near them:

```html
<img src="/img/project-12.webp" loading="lazy" alt="..." width="800" height="600">
```

Use `loading="lazy"` on images below the fold, such as galleries, long article images, and footer logos. Never use it on the LCP image or on anything visible on first load. Googlebot supports native lazy loading and renders pages with a tall viewport. Content that loads only on a scroll event or a click can still be missed. The [lazy loading implementation guide](/articles/#cluster-seo-by-role)<!-- reading-origin:XSgvYXJ0aWNsZXMvbGF6eS1sb2FkaW5nLXNlby1pbXBsZW1lbnRhdGlvbik= --> shows safe patterns for JavaScript galleries.

## Help Google understand each image

Speed brings users. Context brings image search traffic. A site cannot accessibility and SEO its way into performance. The three depend on each other, but each one does its own work.

Write alt text that describes the image for someone who cannot see it. "Roofing crew installing architectural shingles on a two-story house" helps both accessibility and search. "Roofing roofer roof repair" helps neither. Use an empty `alt=""` for decorative images, so screen readers skip them. Missing alt text showed up in about 4 of every 10 site audits I ran at intake.

Use descriptive file names: `kitchen-shaker-cabinets.webp`, not `IMG_4032.webp`. Place each image near the text that explains it. Google reads the surrounding text, the page title, and the caption to understand the image.

Use `<img>` for content images. Google does not index images set as CSS backgrounds.

For a large image library, list images in your sitemap with the image extension:

```xml
<url>
  <loc>https://example.com/projects/kitchen-remodel</loc>
  <image:image>
    <image:loc>https://example.com/img/kitchen-1600.webp</image:loc>
  </image:image>
</url>
```

In 2022, Google deprecated the `image:caption`, `image:title`, `image:geo_location`, and `image:license` tags. Use `image:loc` only. Put captions and titles on the page instead.

## Work through one hero image

Suppose a service business has a hero photo exported from a camera. It is a 6,000-pixel JPEG with full metadata, loaded as a CSS background. It has no dimensions, and a plugin added `loading="lazy"` to it. PageSpeed Insights names it as the LCP element.

1. Move the image from the CSS background into an `<img>` element in the HTML.
2. Export four widths: 640, 1,024, 1,600, and 2,400 pixels.
3. Encode each width as AVIF and WebP, with a JPEG fallback. Start at quality 75, then compare with the original.
4. Strip the camera metadata.
5. Serve the files with `<picture>`, `srcset`, and `sizes="100vw"`.
6. Remove `loading="lazy"`, add `fetchpriority="high"`, and set `width` and `height`.
7. Write alt text that names what the photo shows.
8. Run PageSpeed Insights again and compare LCP, CLS, and total image bytes with your first measurement.

Repeat the steps for each template. Record the results, and set a budget for image bytes per page so the next upload cannot undo the work. The [performance budgets guide](/articles/#cluster-seo-by-role)<!-- reading-origin:XSgvYXJ0aWNsZXMvcGVyZm9ybWFuY2UtYnVkZ2V0cy1zZW8p --> shows how to enforce that limit in the build.

## Check every image before release

Before I hand over a site build, I test it on real phones. Then I run this list:

- The format is AVIF or WebP with a fallback, or SVG for vector art.
- The file is no wider than twice its largest display width.
- The image is compressed and has no unneeded metadata.
- `srcset` and `sizes` are set for images wider than a phone screen.
- `width` and `height` are set on every `<img>`.
- The LCP image is not lazy-loaded and has `fetchpriority="high"`.
- Images below the fold use `loading="lazy"`.
- Alt text describes the image, or is empty for decoration.
- The file name describes the content.
- Content images use `<img>`, not CSS backgrounds.

----

```text
                  .|########||.                                       .|########||.                                       .|########||.
               |##||.      .||##|.                                 |##||.      .||##|.                                 |##||.      .||##|.
             |#|.              .|#|.                             |#|.              .|#|.                             |#|.              .|#|.
           |#|                    |#|                          |#|                    |#|                          |#|                    |#|
         .#|                        |#.                      .#|                        |#.                      .#|                        |#.
        .#.                          .#|                    .#.                          .#|                    .#.                          .#|
       |#.                            .#|                  |#.                            .#|                  |#.                            .#|
      |#             ......             #|                |#             ......             #|                |#             ......             #|
     .#           ||#########|           #|              .#           ||#########|           #|              .#           ||#########|           #|
    .#.         |######||######|.        .#.            .#.         |######||######|.        .#.            .#.         |######||######|.        .#.
    #.        .##|###|##|#|######|        .#            #.        .##|###|##|#|######|        .#            #.        .##|###|##|#|######|        .#
   ||        |##|#||||||||||||#||#|        ||          ||        |##|#||||||||||||#||#|        ||          ||        |##|#||||||||||||#||#|        ||
   #        |#||||||||||||||||||||#|        #.         #        |#||||||||||||||||||||#|        #.         #        |#||||||||||||||||||||#|        #.
  ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||
  #       .#||||||||||||||||||||||||#|       #        #       .#||||||||||||||||||||||||#|       #        #       .#||||||||||||||||||||||||#|       #
 ||   ....|||#||||||##|#|||#|#||##||||....|. ||      ||   ....|||#||||||##|#|||#|#||##||||....|. ||      ||   ....|||#||||||##|#|||#|#||##||||....|. ||
 #.  .  ....|#  ....#|||   ||| .#|||  ....#. .#      #.  .  ....|#  ....#|||   ||| .#|||  ....#. .#      #.  .  ....|#  ....#|||   ||| .#|||  ....#. .#
 #   .  ||||#| .#####||  . .#| .#|||  ||||#   #.     #   .  ||||#| .#####||  . .#| .#|||  ||||#   #.     #   .  ||||#| .#####||  . .#| .#|||  ||||#   #.
.|   |||||  #. |#|||||. ||  #. |#||. .|||||   ||    .|   |||||  #. |#|||||. ||  #. |#||. .|||||   ||    .|   |||||  #. |#|||||. ||  #. |#||. .|||||   ||
||   |....  #. ....|#.      |. ...|. ....||   ||    ||   |....  #. ....|#.      |. ...|. ....||   ||    ||   |....  #. ....|#.      |. ...|. ....||   ||
#.  .||||||##||||||##||####|||||||#||||||#|   .#    #.  .||||||##||||||##||####|||||||#||||||#|   .#    #.  .||||||##||||||##||####|||||||#||||||#|   .#
#    .||####|###########################|.     #    #    .||####|###########################|.     #    #    .||####|###########################|.     #
#      .#||||||.#.|| # |. ..# #| #|||||#|      #    #      .#||||||.#.|| # |. ..# #| #|||||#|      #    #      .#||||||.#.|| # |. ..# #| #|||||#|      #
#      .#|||||| ..  |# ## |#| ...#|#|||#|      #    #      .#|||||| ..  |# ## |#| ...#|#|||#|      #    #      .#|||||| ..  |# ## |#| ...#|#|||#|      #
#      .#|||#|# .# .#| #| ##|.#..#|||||#|      #    #      .#|||#|# .# .#| #| ##|.#..#|||||#|      #    #      .#|||#|# .# .#| #| ##|.#..#|||||#|      #
#      .#||||||############|######|||||#|      #    #      .#||||||############|######|||||#|      #    #      .#||||||############|######|||||#|      #
#   |...||#||||||#||||#|#||||||#|||||#||| |.|  #    #   |...||#||||||#||||#|#||||||#|||||#||| |.|  #    #   |...||#||||||#||||#|#||||||#|||||#||| |.|  #
#. .. ||||# .|||##|.  |#| .|| || .|||#. #|  # .#    #. .. ||||# .|||##|.  |#| .|| || .|||#. #|  # .#    #. .. ||||# .|||##|.  |#| .|| || .|||#. #|  # .#
|| |  ...||  ...##| |  #| .|. |. #####  .. .| ||    || |  ...||  ...##| |  #| .|. |. #####  .. .| ||    || |  ...||  ...##| |  #| .|. |. #####  .. .| ||
|| ||||| || ||||#|  .  |. |. |#. ||||| |#| || ||    || ||||| || ||||#|  .  |. |. |#. ||||| |#| || ||    || ||||| || ||||#|  .  |. |. |#. ||||| |#| || ||
.# |.....#|....|#.||||.|||##.|#|....||.#||.#. #.    .# |.....#|....|#.||||.|||##.|#|....||.#||.#. #.    .# |.....#|....|#.||||.|||##.|#|....||.#||.#. #.
 #.|||||||#############################| ||| .#      #.|||||||#############################| ||| .#      #.|||||||#############################| ||| .#
 ||       ##||#||#||||||#||#||#||#||##.      ||      ||       ##||#||#||||||#||#||#||#||##.      ||      ||       ##||#||#||||||#||#||#||#||##.      ||
  #       .#|||||||||#||#|||||||||||#|       #        #       .#|||||||||#||#|||||||||||#|       #        #       .#|||||||||#||#|||||||||||#|       #
  ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||        ||       |#||||||||||||||||||||||#|       ||
  .#        |#||||||||||||||||||||#|        #.        .#        |#||||||||||||||||||||#|        #.        .#        |#||||||||||||||||||||#|        #.
   ||        |#||||||||||||||||||#|        ||          ||        |#||||||||||||||||||#|        ||          ||        |#||||||||||||||||||#|        ||
    #.        .######|#|#########|        .#            #.        .######|#|#########|        .#            #.        .######|#|#########|        .#
    .#.         |#####||||#####|         .#.            .#.         |#####||||#####|         .#.            .#.         |#####||||#####|         .#.
     |#           ||########||           #.              |#           ||########||           #.              |#           ||########||           #.
      |#             ......             #|                |#             ......             #|                |#             ......             #|
       |#.                            .#|                  |#.                            .#|                  |#.                            .#|
        |#.                          .#.                    |#.                          .#.                    |#.                          .#.
         .#|                        |#.                      .#|                        |#.                      .#|                        |#.
           |#|                    |#|                          |#|                    |#|                          |#|                    |#|
            .|#|.              .|#|.                            .|#|.              .|#|.                            .|#|.              .|#|.
               |##||.      .||##|                                  |##||.      .||##|                                  |##||.      .||##|
                 .||########||.                                      .||########||.                                      .||########||.

Scale With Search  2026  [scalewithsearch.com](https://scalewithsearch.com)
```
