How search engines work out what an image shows
Google combines several clues: the file name, the alt attribute, the text around the image, the page title and headings, structured data and its own visual analysis of the picture. None of these works alone. A well-named image on a page about something unrelated will still struggle to rank.
The practical takeaway is to place images close to the text that describes them, and to make sure the page is about the same thing as the image. Use a standard <img> element with a src attribute, because images set as CSS backgrounds are not indexed as images.
File names: a small effort with a clear signal
Camera and design tool defaults such as IMG_4821.jpg or final-v3-export.png tell search engines nothing. Rename files before uploading, using a few words that describe the subject.
- Use lowercase words separated by hyphens, such as
oak-dining-table-six-seater.jpg. - Describe what is in the picture, not what you would like to rank for.
- Keep it short; four or five words is usually enough.
- Avoid renaming images that already bring in traffic from Google Images unless you also redirect the old file URL.
Writing alt text that does a job
Alt text exists first for people using screen readers, and it is also shown when an image fails to load. Search engines use it as a strong clue to the image's content. Good alt text serves all three at once.
Describe the image in the context of the page, in one plain phrase or sentence. Compare these options for a photo on a furniture product page:
- Too thin:
alt="table" - Stuffed:
alt="dining table oak table wooden table buy dining table UK" - Useful:
alt="Solid oak dining table with six matching chairs in a bright kitchen"
Purely decorative images, such as background flourishes or divider graphics, should have an empty attribute, alt="", so screen readers skip them. Leaving the attribute out entirely is different, because some screen readers then read the file name aloud.
Before images go live, we apply the Nimtanine method: read the alt text aloud without looking at the image and ask whether a listener would understand what it shows and why it is on the page.
Compression and modern formats
Images are often the heaviest files on a page, which makes them the easiest place to save load time. Two decisions matter most: the format and the compression level.
- WebP is supported by all major browsers and is usually noticeably smaller than JPEG at similar visual quality.
- AVIF often compresses further still, and browser support is now broad.
- JPEG remains a safe fallback for photographs, and PNG suits graphics that need sharp edges or transparency when WebP is not an option.
- SVG is ideal for logos and icons, because it stays sharp at any size and is usually very light.
For compression, tools such as Squoosh, ShortPixel or your CMS's built-in optimizer let you lower quality until artifacts appear, then step back slightly. Most photos look identical to the eye at a fraction of their original size. Many platforms and CDNs can also convert formats automatically, which saves manual work on every upload.
Sizing, dimensions and lazy loading
Uploading a 4,000-pixel photo and displaying it at 800 pixels wastes bandwidth on every visit. Resize images to the largest size they will actually appear at, and use the srcset and sizes attributes so phones download a smaller version than desktops.
Always include width and height attributes. They let the browser reserve space before the image arrives, which prevents layout shift.
Add loading="lazy" to images further down the page so they load only as visitors approach them. Leave it off the main image at the top, since delaying that image slows Largest Contentful Paint.
For sites where image search matters, such as recipes, products or travel, an image sitemap or image entries in your existing sitemap help Google find files it might otherwise miss.
Before and after: one product photo
Imagine a furniture shop uploading a photo straight from the photographer: DSC_0193.jpg, several megabytes, 5,000 pixels wide, no alt text, displayed at 900 pixels.
A few minutes of work turns it into walnut-coffee-table-round.webp, resized to 1,800 pixels for high-density screens, compressed to a small fraction of the original weight, with alt text reading "Round walnut coffee table with tapered legs on a wool rug". It has width and height set, sits beside the product description, and loads without delay because it is the main image.
Nothing about the photo itself changed. It is simply easier to find, quicker to load and usable by everyone who visits. Repeat the same routine for the gallery images further down the page, adding lazy loading to those, and the whole product page benefits without any change to its design.