The definitive guide: optimizing images for SEO in 2025

📅 May 18, 2025 ⏱️ 9 min read 🏷️ SEO

Images are the heaviest asset on most web pages, and also one of the most neglected SEO factors. Google doesn't just index images — it uses them to understand your page's context, evaluate your loading speed, and determine your position in search results. This guide covers everything you need to know.

Table of contents

  1. Descriptive file names
  2. Alt text: the most important factor
  3. Image size and format
  4. Lazy loading
  5. srcset and responsive images
  6. Structured data for images
  7. Complete checklist

1. Descriptive file names

The file name of an image is a direct signal to Google. A file called IMG_4892.jpg tells the search engine nothing; one called mens-running-shoes-nike-air.jpg does.

Rules for SEO-friendly image names

Bad nameGood name
IMG_001.jpghomemade-paella-recipe-spain.jpg
header_image.pngmodern-living-room-interior-design.png
photo.webpmacbook-pro-laptop-2024.webp
banner_v2_final.jpgonline-python-programming-course.jpg

2. Alt text: the most important factor

The alt attribute is the most valuable SEO element of an image. It serves three purposes: it helps Google understand the image content, improves accessibility for screen reader users, and appears if the image fails to load.

Golden rule: write alt text as if you were describing the image to someone who cannot see it. Be specific, include the main keyword naturally, and don't start with "image of" or "photo of".

Alt text examples

SituationIncorrect alt textCorrect alt text
E-commerce productsneakerNike Air Max 270 in white, size US 9
Decorative imagedecorative image(leave empty: alt="")
Chart/infographicsales chartBar chart: e-commerce sales growth in the US 2020–2024
LogologoComprimirPro logo

Watch out for keyword stuffing: writing alt="compress image compress photos compress JPG online free" is spam and can get you penalized. One natural keyword is enough.

3. Image size and format

Google has used page speed as a ranking factor since 2010, and images are the main culprit for slow pages. Google's recommendations for web images:

Image typeRecommended formatIdeal max size
Photos, heroes, bannersWebP (JPG fallback)100–200 KB
Images with transparencyWebP (PNG fallback)50–150 KB
Icons and vector graphicsSVG< 20 KB
Content images (blog)WebP50–120 KB
ThumbnailsWebP< 30 KB

Optimize your images for SEO now

Convert and compress all your images to WebP in seconds, directly in your browser.

⚡ Compress images for free

4. Lazy loading: don't load what isn't visible

Lazy loading defers loading images that are outside the user's visible window, improving initial load time. In modern HTML it is trivial to implement:

<img src="image.webp" alt="Description" loading="lazy" />

Important rules:

5. srcset: serve the right size to each device

Serving a 1400px-wide image to a phone with a 390px screen is a massive waste. The srcset attribute lets the browser choose the most appropriate version for each device:

<img
  src="image-800.webp"
  srcset="image-400.webp 400w,
          image-800.webp 800w,
          image-1200.webp 1200w"
  sizes="(max-width: 600px) 100vw,
         (max-width: 1200px) 50vw,
         800px"
  alt="Image description"
  loading="lazy"
/>

6. Structured data for images

For certain content types, you can use Schema.org so Google displays your images in rich results. The most useful cases:

To appear in Google Discover and Top Stories, the image must be at least 1200px wide and declared in the page schema.

Complete image SEO checklist

Summary: image SEO optimization is not just about reducing file size. It is a set of practices that affect rankings, speed, accessibility, and visibility in Google Images. Implementing this checklist can significantly improve your PageSpeed score in just a few hours.

Related articles

ComprimirPro Team

Image optimization and web performance specialists. We share practical guides to make the web faster.

Ready to optimize your images?

Free, instant, private. No sign-up required.

⚡ Use ComprimirPro now