Image SEO

How do you optimize images for SEO?

A source-checked guide to file names, alt text, compression, formats and image sitemaps, with a format table and a step-by-step checklist.

Klepha blog graphic with the headline How to optimize images for SEO beside an illustrated image card showing mountains and a sun

To optimize images for SEO, embed them with a real <img> element, give them short descriptive file names and accurate alt text, place them near relevant text, and serve compressed, correctly sized files in a modern format such as WebP or AVIF with a fallback. Then make sure Google can find them, with an image sitemap for images it might otherwise miss, and never lazy load the image that is your Largest Contentful Paint.

Everything below comes from Google Search Central, web.dev, MDN and the W3C, re-read on November 19, 2026. Where the docs are silent, such as on exact compression settings, we say so.

Key takeaways

  • Use real image elements: Google finds images in the src of <img>, including inside <picture>, and does not index CSS background images.
  • Alt text matters most: Google calls alt text the most important image attribute. Describe the image in context and avoid keyword stuffing.
  • File names are light clues: my-new-black-kitten.jpg beats IMG00023.JPG, but names alone will not carry an image.
  • Prefer WebP or AVIF for raster images: MDN recommends them over JPEG, PNG and GIF, with a JPEG or PNG fallback via <picture>. Use SVG for icons and diagrams.
  • Protect LCP: do not lazy load images in the first viewport, and consider fetchpriority="high" on the likely LCP image.
  • Image sitemaps only need two tags: <image:image> and <image:loc>. Caption, title, geo and license tags are deprecated.

Why does image SEO still matter?

Images appear in more places than the Images tab. Google’s image SEO best practices page (last updated March 2, 2026) lists text result images, Google Discover and Google Images as visual surfaces, and says the general recommendations for appearing in all of them are the same. In other words, one set of habits covers every surface.

Images also shape speed: Google says they are often the largest contributor to page size. web.dev’s lazy loading guide cites HTTP Archive data showing that images are the most requested asset type on most websites, and that at the 90th percentile sites send over 5 MB of images on desktop and mobile. Image work belongs in every technical SEO audit.

How should you embed images so Google can find them?

Use standard HTML image elements. Google states that it can find images in the src attribute of an <img> element, even when it is a child of other elements such as <picture>, and that it does not index CSS images. A product photo set as a background-image on a <div> is invisible to Google Images.

Always keep a fallback src

Responsive images use srcset or the <picture> element. Google notes that some browsers and crawlers do not understand these attributes, so it recommends always specifying a fallback URL in src. When you use <picture>, include an <img> with a src as the fallback, in line with the HTML Standard. A safe pattern looks like this:

<picture>
  <source type="image/avif" srcset="black-kitten-800.avif">
  <source type="image/webp" srcset="black-kitten-800.webp">
  <img src="black-kitten-800.jpg" alt="Black kitten asleep on a gray wool blanket"
       width="800" height="533">
</picture>

Reuse one URL per image

If the same image appears on many pages of a large site, Google recommends consistently referencing it with the same URL so it can cache and reuse the file instead of requesting it repeatedly. Image URLs also break quietly in redesigns, so include them in your website migration SEO checklist.

Supported formats

Google Search supports images referenced in an <img> src in BMP, GIF, JPEG, PNG, WebP, SVG and AVIF. Google also advises that the file extension should match the file type. Inline data URIs are allowed, but Google warns they can considerably increase page size.

What makes a good image file name?

Google describes the file name as giving “very light clues” about the subject of the image. Its guidance is short and practical:

Rename files before upload, because renaming a live image changes its URL. And since the signal is light, fix missing alt text and surrounding copy first.

How do you write alt text for SEO and accessibility?

Google calls alt text “the most important attribute” for image metadata. It uses alt text together with computer vision and the page’s content to understand the image, and alt text on a linked image works as anchor text. The same text helps people using screen readers and people on low-bandwidth connections.

Google’s own ladder of examples is the clearest guide:

Practical rules for alt text

Placement matters too. Google says it extracts information from page content, including captions and image titles, and recommends placing images near relevant text on pages relevant to the image subject. Our on-page SEO checklist covers the surrounding copy in more depth.

Which image format should you use?

MDN’s image file type and format guide gives a clear default: for raster images, prefer WebP or AVIF, which generally compress better than PNG, JPEG and GIF, and use <picture> to supply a PNG or JPEG fallback where needed. For diagrams, charts and icons that must render accurately at any size, use SVG. MDN advises lossless encoding for screenshots and line art; photos usually tolerate lossy compression.

FormatCompressionTransparencyBest forNotes from the docs
JPEGLossyNoPhotographs, as a fallbackMDN: good for lossy still images; JPEG has no alpha channel. Universally supported.
PNGLosslessYesScreenshots, line art, fallback for transparencyMDN: preferred over JPEG for precise reproduction or when transparency is needed.
WebPLossy and losslessYesMost photos and graphics on the webMDN: much better compression than PNG or JPEG; supports animation.
AVIFLossy and losslessYesPhotos where smallest size mattersMDN: slightly better compression than WebP, no progressive rendering; include fallbacks. web.dev: supported in Chrome and Opera since 2020, Firefox 2021, Safari 2022.
SVGVector (not pixel based)YesLogos, icons, diagrams, chartsMDN: ideal for elements drawn accurately at any size.

All five are on Google’s supported list, and its documentation does not rank formats for search. The choice is about file size and quality.

See which images are slowing down or hiding your pages

Run a free Klepha scan to spot missing alt text, oversized images and other technical issues that affect search and AI visibility. No guarantees, just a clear list of what to fix.

Run my free scan

How much should you compress and resize images?

Google wants sharp, high-quality images and fast pages. The way through is to stop shipping pixels nobody sees.

Resize to the displayed size

Serve multiple widths with srcset and sizes so a phone does not download a desktop hero. Google’s own example lists 320w, 480w and 800w versions of the same image with an 800w fallback in src. Chrome’s Lighthouse audits for properly sized images, modern formats and efficient encoding will flag the worst offenders.

Compress, then check by eye

web.dev notes that WebP, like JPEG, exposes a single quality value from 0 to 100 and recommends experimenting with encoder settings, for example in Squoosh, to see the trade-off between file size and quality. None of the primary sources prescribe a universal quality number or a maximum file size, so treat any fixed rule you see online with caution. Compare against the original at display size and stop where artifacts appear.

Use caching and an image CDN

web.dev’s Optimize LCP guide recommends a CDN to shorten the distance files travel, notes that image CDNs usually apply size reductions automatically, and recommends an efficient cache-control policy so repeat visitors load images from cache. If your images live on a CDN domain, Google’s image sitemap documentation asks you to verify that domain in Search Console.

How do lazy loading and LCP affect image SEO?

Largest Contentful Paint (LCP) is one of the three Core Web Vitals, and on many pages the LCP element is an image. web.dev says sites should strive for an LCP of 2.5 seconds or less for at least 75% of page visits.

Lazy load below the fold only

Browser-level lazy loading with loading="lazy" defers offscreen images until the user scrolls near them, and browsers that do not support it simply ignore the attribute. But web.dev is explicit: images visible in the first viewport, and especially LCP images, should use the browser’s default eager loading.

Make the LCP image discoverable and prioritized

Reserve space with width and height

web.dev recommends width and height attributes on all <img> tags so the browser can reserve space and avoid layout shifts. For wider Core Web Vitals triage, see how to fix technical SEO issues.

Do you need an image sitemap?

Not always, but it helps when Google might miss images. Google’s Image sitemaps documentation (last updated December 10, 2025) describes them as a way to tell Google about images it might not otherwise find, such as images your site loads with JavaScript. You can create a separate image sitemap or add image tags to your existing sitemap; Google says either approach is equally fine.

The required tags

Google has removed <image:caption>, <image:geo_location>, <image:title> and <image:license> from its documentation, per a 2022 deprecation announcement. If your CMS still outputs them, they are not needed for Google. Here is a minimal example adapted from Google’s documentation:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  <url>
    <loc>https://example.com/kittens/black-kitten</loc>
    <image:image>
      <image:loc>https://cdn.example.com/img/black-kitten-800.jpg</image:loc>
    </image:image>
    <image:image>
      <image:loc>https://cdn.example.com/img/black-kitten-playing.jpg</image:loc>
    </image:image>
  </url>
</urlset>

Note that <loc> is the page URL and <image:loc> is the image URL. General sitemap best practices also apply; submit it in Search Console and check the sitemap report for errors.

How do landing pages and metadata help images rank?

Google says the content and metadata of the page where an image is embedded can greatly influence how and where the image appears. Three levers stand out in its documentation:

Clear, crawlable, well-described pages also help with AI search; see our search and AI visibility solutions, our expertise and our case studies.

Step-by-step image SEO checklist

Work through these per template (product, article, category), not image by image.

  1. Audit how images are embedded. Replace content images set as CSS backgrounds with <img> elements, and make sure every <picture> or srcset has a fallback src.
  2. Rename files before upload. Use short, descriptive, hyphenated names and translate them on localized pages.
  3. Write alt text in context. Describe the image as it relates to the page, avoid keyword lists, and use alt="" for decorative images.
  4. Place images near relevant text. Add captions where they help readers understand the image.
  5. Choose the right format. WebP or AVIF for photos with a JPEG or PNG fallback, SVG for logos, icons and diagrams, lossless for screenshots.
  6. Resize and compress. Generate several widths for srcset, compress until just before artifacts appear, and serve from a CDN with long cache lifetimes.
  7. Set width and height. Add dimensions to every <img> to prevent layout shifts.
  8. Handle loading priority. Use loading="lazy" only below the fold, keep the LCP image eager and in the initial HTML, and add fetchpriority="high" to it.
  9. Add an image sitemap if needed. List images Google may not find, using only <image:image> and <image:loc>, and verify any CDN domain in Search Console.
  10. Set preferred image metadata. Add og:image and schema.org image properties that point to a representative, high-resolution image.
  11. Measure. Check PageSpeed Insights field data for LCP and use Search Console to confirm sitemaps process without errors.

Sources

Frequently asked questions

Does alt text help images rank in Google?

Yes, it is one of the signals Google uses. Google calls alt text the most important attribute for image metadata and uses it with computer vision and page content to understand an image. Write a short, accurate description in context and avoid stuffing it with keywords.

Do image file names matter for SEO?

A little. Google says file names give very light clues about an image's subject, so a short descriptive name such as black-kitten.jpg is better than IMG00023.JPG. Alt text, captions and nearby text matter more.

Is WebP or AVIF better for SEO?

Google Search supports both, along with JPEG, PNG, GIF, BMP and SVG, and does not rank one format above another. MDN notes AVIF usually compresses slightly better while WebP has broader support and progressive rendering, so many sites serve AVIF or WebP with a JPEG fallback through the picture element.

Do I need an image sitemap?

Only if Google might not find your images otherwise, for example images loaded with JavaScript or hosted on a CDN. Google says you can add image tags to an existing sitemap or create a separate one. Only the image:image and image:loc tags are required.

Should I lazy load all images?

No. web.dev recommends lazy loading only images outside the first viewport. Images visible on load, especially the Largest Contentful Paint image, should load eagerly, and the LCP image can be given fetchpriority high.

Does Google index CSS background images?

No. Google states that it does not index CSS images. Use an img element, optionally inside a picture element, for any image you want to appear in Google Images or Discover.

Garry Charter

SEO Specialist · Klepha

Twelve years in search, covering technical SEO, keyword research and, since generative search arrived, answer engine and generative engine optimization. Writes Klepha's guides on ranking in Google and being cited by AI assistants.