CompressImg
Guide··12 min read

Image SEO: Complete Guide to Optimizing Images for Google (2026)

Images affect SEO in more ways than most developers and content creators realize. File size affects Core Web Vitals. Alt text affects accessibility and keyword indexing. File names affect how Google understands and surfaces images. This guide covers every factor that influences image SEO — with specific settings and tactics for 2026.

Image SEO Checklist

File size under 200 KB for most images (under 100 KB for thumbnails)
Alt text on every image — descriptive, keyword-relevant
Descriptive file names (use hyphens, not underscores)
Explicit width and height attributes on all img tags
Next-gen format: WebP or AVIF instead of JPEG/PNG
Lazy loading (loading="lazy") on below-fold images
LCP image preloaded with <link rel="preload">
Images included in sitemap.xml (with image:image extension)
Structured data: ImageObject where applicable

1. File Size and Core Web Vitals

Image file size is the single largest factor in page load speed for most websites. Google's Core Web Vitals — specifically LCP (Largest Contentful Paint) and INP — are direct ranking factors. If your hero image is a 2 MB JPEG, it is almost certainly causing your LCP to fail.

Google's target is LCP under 2.5 seconds on a mobile connection. For a typical hero image, this means the image itself must be under 150–300 KB, depending on your server response time and other page resources.

Image typeMax file sizeFormat
Hero / banner image150–250 KBWebP
Product photo (main)80–150 KBWebP
Blog inline image60–120 KBWebP or JPEG
Thumbnail20–50 KBWebP
Logo (raster)15–30 KBPNG or SVG
Icon< 5 KBSVG or PNG

Compress images for free — reduces JPEG, PNG, and WebP to the target ranges above with a quality slider.

2. Alt Text — What Google Actually Reads

Alt text (the alt attribute on <img> tags) is the primary signal Google uses to understand image content. It is also read by screen readers for visually impaired users.

Avoid:

  • alt="" — empty (only correct for purely decorative images)
  • alt="image" or alt="photo" — meaningless
  • alt="IMG_4521.jpg" — raw file names
  • Keyword stuffing: alt="buy shoes cheap shoes discount shoes sale"

Do instead:

  • Describe what the image actually shows: alt="White leather sneakers on a wooden floor"
  • Include the primary keyword naturally if it fits the description
  • Keep it under 125 characters (screen reader limit)
  • Match the alt text to the surrounding page topic

3. File Names — How to Name Image Files for SEO

Google reads file names as a secondary signal about image content. A file named DSC_4521.jpg tells Google nothing. white-leather-sneakers-side-view.jpg is descriptive and keyword-relevant.

File naming rules:

  • Use hyphens between words, not underscores (red-dress.jpg not red_dress.jpg)
  • All lowercase letters — avoid spaces and special characters
  • Be descriptive: 2–5 words that match the image content
  • Include the primary keyword for the page if it naturally fits
  • Do not repeat the same file name across multiple images on a site

4. Image Dimensions and Responsive Images

Serving images at the correct display size is critical for performance. If your page displays a thumbnail at 300px wide but you serve a 2000px image, the browser downloads 40× more data than needed.

The srcset attribute lets you serve different image sizes based on the viewport and screen density:

<img
  src="product-400.jpg"
  srcset="product-400.jpg 400w, product-800.jpg 800w, product-1200.jpg 1200w"
  sizes="(max-width: 640px) 100vw, 800px"
  alt="Product description"
  width="800"
  height="600"
/>

Always include explicit width and height attributes to prevent Cumulative Layout Shift (CLS) — a Core Web Vital Google uses directly in rankings.

5. Next-Gen Formats: WebP and AVIF

Google PageSpeed Insights flags JPEG and PNG files with the warning "Serve images in next-gen formats." This is a direct instruction to convert to WebP or AVIF.

WebP

Size: 25–35% smaller than JPEG

Support: All modern browsers (97%+)

Convert JPEG → WebP for all web images

AVIF

Size: 40–60% smaller than JPEG

Support: ~90% browsers (Chrome, Firefox, newer Safari)

Use with <picture> element and WebP fallback

6. Lazy Loading

Adding loading="lazy" to below-the-fold images tells the browser not to load them until the user scrolls near them. This reduces initial page weight and improves LCP for the images that matter most.

<!-- Hero image — do NOT lazy load (it's the LCP element) -->
<img src="hero.webp" alt="..." width="1200" height="600" />

<!-- Below-fold images — do lazy load -->
<img src="feature.webp" alt="..." width="800" height="500" loading="lazy" />

Never lazy-load the LCP image (usually the hero or above-fold image). Lazy loading the LCP image delays its rendering and hurts your LCP score.

7. Preloading the LCP Image

If your hero image is loaded via CSS background or a JavaScript framework, the browser discovers it late — hurting LCP. Add a preload hint to tell the browser to start fetching the LCP image immediately:

<link
  rel="preload"
  as="image"
  href="/hero.webp"
  type="image/webp"
/>

This is one of the highest-impact changes for LCP on image-heavy pages. Adding a preload for the LCP image typically improves LCP by 0.3–1.0 seconds on mobile.

8. Structured Data for Images

Schema.org structured data helps Google understand images in context and surface them in rich results like Google Images and knowledge panels.

ImageObject

When the image is the primary subject of the page — photography portfolio, stock image site

Product > image

E-commerce product pages — required for Google Shopping rich results

Recipe > image

Recipe pages — triggers recipe rich results in search

Article > image

Blog and news articles — displays the article image in Google Discover and Top Stories

9. Image Sitemap

Adding images to your sitemap helps Google discover images it might otherwise miss — especially images loaded by JavaScript or CSS. Use the image:image sitemap extension:

<url>
  <loc>https://example.com/products/red-sneakers</loc>
  <image:image>
    <image:loc>https://example.com/images/red-sneakers.webp</image:loc>
    <image:title>Red leather sneakers</image:title>
    <image:caption>Red leather running sneakers, side view</image:caption>
  </image:image>
</url>

Related Tools

Frequently Asked Questions

Does image optimization affect SEO?

Yes, significantly. Image file size directly affects LCP — a Core Web Vital that Google uses as a ranking signal. Alt text affects how Google understands and indexes images. Correct file names and structured data affect visibility in Google Images and rich results.

What is the best image format for SEO?

WebP is the recommended format for web images in 2026. It produces 25–35% smaller files than JPEG at the same visual quality, which improves LCP. Google PageSpeed Insights explicitly recommends converting to WebP or AVIF.

How does image alt text help SEO?

Alt text is the primary text signal Google uses to understand image content. It influences ranking in Google Images and provides keyword context to the surrounding page content. Write natural descriptions of what the image shows — include the page keyword only when it fits naturally.

What file size should images be for SEO?

Hero images should be under 150–250 KB. Blog images under 120 KB. Thumbnails under 50 KB. These targets support LCP scores under 2.5 seconds on mobile, which is Google's benchmark for a good page experience.

Does lazy loading help SEO?

Adding loading="lazy" to below-fold images reduces initial page load weight, which can improve LCP for the visible images. Never lazy-load the LCP image itself — that delays the most important element and directly hurts LCP scores.

Should I include images in my XML sitemap?

Yes, especially for e-commerce and photography sites where image discovery is important. The image sitemap extension (image:image) helps Google discover images it might otherwise miss, particularly images loaded via JavaScript.

Does image file name affect Google ranking?

File names are a weak but real signal. Google reads file names when indexing images. A descriptive file name like "red-running-shoes.webp" is preferable to "IMG_4521.jpg". Use hyphens, not underscores, between words.

How do I fix the "serve images in next-gen formats" warning in PageSpeed?

Convert your JPEG and PNG images to WebP. Use the free JPG to WebP or PNG to WebP tools at compressimg.pro. Then update your img tags to serve the .webp files. The warning will clear in the next PageSpeed test.