Image SEO: filenames, alt text and compression

Images can bring traffic of their own and can hold a page back. Most of what matters is unglamorous: describe them honestly, size them properly, and let them be crawled.

What actually matters

Alt text
Describe the image's content and function. Not a keyword slot.
Filename
Descriptive and hyphenated. A small signal, but free.
File size
Affects LCP, which is a ranking signal. The biggest indirect factor.
Surrounding text
Context near the image carries real weight for image search.
Dimensions in markup
Prevents layout shift, which is also measured.
Originality
Unique photography outperforms the same stock image everyone else used.
Crawlability
Images loaded only by JavaScript may never be indexed.

Getting images right

  1. Step 1: Name the file for what it shows

    blue-ceramic-mug-handmade.jpg rather than IMG_4821.jpg. Use hyphens between words. This is a modest signal, but it costs nothing and it also makes your own media library navigable.

  2. Step 2: Write alt text for someone who cannot see it

    Describe what the image shows and why it is there. If it is purely decorative, use an empty alt attribute so screen readers skip it. Never stuff keywords — it helps nobody and reads as spam to both people and search engines.

  3. Step 3: Compress and size properly

    Resize to display size, compress at quality 78–85, serve WebP. This is the largest indirect ranking factor images have, because it moves Largest Contentful Paint.

  4. Step 4: Make them crawlable and give them context

    Use real img elements with src attributes rather than images injected purely by JavaScript. Put relevant text near the image, use a caption where it genuinely helps, and include images in your sitemap.

Details worth knowing

Alt text, written properly

Alt text exists so that someone who cannot see the image still receives its information. That is its purpose, and writing it for that purpose also happens to be what performs best.

Good
"A handmade blue ceramic mug with a rough unglazed base, on a wooden table"
Useless
"mug"
Spam
"buy mug cheap mugs ceramic mug online best mug"
Redundant
"Image of a mug" — screen readers already announce that it is an image

Two rules people miss. Decorative images should have an empty alt attribute, not a missing one, so assistive technology skips them silently. And if the image is a link, the alt text should describe where the link goes, because that is its function.

Speed is the biggest indirect factor

Alt text and filenames are small signals. Page experience is a larger one, and images are usually the element it turns on.

An oversized hero image delays Largest Contentful Paint, which is a Core Web Vitals metric used as a ranking signal. Images without declared dimensions cause layout shift, which is also measured. Both are fixed by things covered elsewhere on this site — resizing, compressing and adding width and height.

If you only do one thing for image SEO, make the images smaller.

Getting into image search

Image search is a genuine traffic source for recipes, products, travel and anything visual. What helps:

  • Original images. The same stock photograph on four hundred sites has no reason to rank on yours.
  • Surrounding text. The words near an image are among the strongest signals about what it depicts.
  • Captions, where they genuinely add something. They are read more than body text.
  • An image sitemap, or image entries in your existing one, particularly for images loaded by script.
  • Structured data. Product, Recipe and Article markup all take an image property, which is what feeds rich results.

Ways images become invisible

  • CSS background images. Not content, not indexed. Use img for anything meaningful.
  • JavaScript-only loading without a real src, which may never be discovered.
  • Blocked directories in robots.txt — an easy accident when an uploads folder gets disallowed.
  • Missing alt attributes, which remove the clearest description you had.
  • Lazy loading implemented badly, without a proper fallback.

Formats and filenames

WebP is fully supported by search engines and by every current browser, so serving it costs you nothing in indexing terms and saves 25–35% of the bytes.

On filenames: descriptive and hyphenated is better than IMG_4821.jpg, and that is roughly the extent of it. Do not rename files on an established site purely for this — you will break every existing link to them for a signal that is genuinely small.

Do it here instead

These run in your browser on any device, so nothing is uploaded and there is nothing to install.

  • Bulk compressor

    One setting across a whole folder, processed in parallel, downloaded as a ZIP.

    Open the tool
  • JPG to WebP

    Typically 25–35% smaller at matched quality. The standard web win.

    Open the tool
  • Resize image

    By pixels or percentage, aspect ratio locked, across a whole batch.

    Open the tool
  • Remove EXIF data

    Strip GPS coordinates, camera model and timestamps before you publish.

    Open the tool

Questions

Frequently asked questions

Every answer below is present in the page source, expanded, so it can be read without opening anything.

Does alt text help SEO?

Yes, modestly, and it is the clearest description of an image available to a search engine. Its primary purpose is accessibility, and writing it properly for that purpose is also what performs best. Keyword stuffing helps nobody and reads as spam.

Do image filenames matter?

A little. A descriptive hyphenated name is better than IMG_4821.jpg, and it costs nothing when you are naming a new file. It is not worth renaming files on an established site — you would break existing links for a very small signal.

Does image compression affect rankings?

Indirectly and more than anything else on this page. Oversized images delay Largest Contentful Paint, which is a Core Web Vitals metric used as a ranking signal. Compression is the largest lever images give you.

Should decorative images have alt text?

They should have an empty alt attribute — alt="" — not a missing one. That tells assistive technology to skip the image silently. A missing attribute leaves screen readers to guess, often by reading out the filename.

Do I need an image sitemap?

Useful if you have many images that matter, or images loaded by JavaScript that might otherwise be missed. For a small site with plain img elements in the HTML, your normal sitemap and internal links are generally enough.

Are CSS background images indexed?

Generally not — they are treated as presentation rather than content. Anything meaningful should be a real img element with an alt attribute. Keep CSS backgrounds for textures and decoration.

From the blog

Related reading

More background from the blog.

  • Practical Guides

    How to Compress Images for a Website Without Wrecking Them

    Resize before you compress. Measured on one photograph: half the width at quality 80 produced a 16.4 KB file, while full width at quality 40 produced 20.6 KB and looked far worse. The order of operations matters more than the settings.

    8 min read

  • Image Formats

    WebP vs JPEG: Which Should You Use, and When JPEG Still Wins

    WebP produced a 27.0 KB file against MozJPEG's 41.1 KB on the same photograph at slightly higher measured fidelity — 34% smaller. It also produced a larger file than JPEG on random noise. The advantage is real and content-dependent.

    9 min read

  • Practical Guides

    How to Strip EXIF Data From Photos, and What Breaks When You Do

    A photograph from a phone can carry the coordinates of the place it was taken, the camera serial number and the exact timestamp. Removing that data is straightforward. Removing it carelessly rotates your photos sideways.

    9 min read