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.
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.
-), never underscores (_)| Bad name | Good name |
|---|---|
| IMG_001.jpg | homemade-paella-recipe-spain.jpg |
| header_image.png | modern-living-room-interior-design.png |
| photo.webp | macbook-pro-laptop-2024.webp |
| banner_v2_final.jpg | online-python-programming-course.jpg |
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".
| Situation | Incorrect alt text | Correct alt text |
|---|---|---|
| E-commerce product | sneaker | Nike Air Max 270 in white, size US 9 |
| Decorative image | decorative image | (leave empty: alt="") |
| Chart/infographic | sales chart | Bar chart: e-commerce sales growth in the US 2020–2024 |
| Logo | logo | ComprimirPro 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.
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 type | Recommended format | Ideal max size |
|---|---|---|
| Photos, heroes, banners | WebP (JPG fallback) | 100–200 KB |
| Images with transparency | WebP (PNG fallback) | 50–150 KB |
| Icons and vector graphics | SVG | < 20 KB |
| Content images (blog) | WebP | 50–120 KB |
| Thumbnails | WebP | < 30 KB |
Convert and compress all your images to WebP in seconds, directly in your browser.
⚡ Compress images for freeLazy 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:
width and height on the tag to prevent layout shifts (CLS)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"
/>
For certain content types, you can use Schema.org so Google displays your images in rich results. The most useful cases:
schema.org/Recipe with image — appears in Google visual carouselsschema.org/Product with image — Shopping and Google Imagesschema.org/Article with image — Top Stories and DiscoverTo appear in Google Discover and Top Stories, the image must be at least 1200px wide and declared in the page schema.
width and height attributes defined in HTMLSummary: 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.