Image SEO: Alt Text, File Names, Formats and File Size

Good image SEO helps your pictures appear in image search and keeps pages fast. Here is how to handle alt text, file names, formats, sizing and lazy loading.

Image SEO: Alt Text, File Names, Formats and File Size

Image SEO means making your images understandable to search engines and fast for visitors: descriptive alt text, clear file names, a modern format such as WebP or AVIF, and files sized to the space they actually fill. Done well, it helps images appear in Google Images and keeps them from dragging down Core Web Vitals such as Largest Contentful Paint (LCP) and Cumulative Layout Shift (CLS).

Key takeaways

  • Alt text is for people using screen readers first; useful alt text also gives search engines context.
  • Use descriptive, hyphenated file names instead of IMG_4821.jpg.
  • Serve WebP or AVIF where possible, at the dimensions the layout needs, and compress them.
  • Set width and height, lazy-load below-the-fold images, and never lazy-load the main hero image.

Write alt text that actually describes the image

The alt attribute provides a text alternative for an image. Screen readers read it aloud, browsers show it if the image fails to load, and search engines use it, together with surrounding text, to understand what the image shows.

Good vs bad alt text

ImageWeak alt textBetter alt text
Product photoshoeBlue lightweight trail running shoe, side view
Team photoimage of team best SEO agencyFive members of the support team standing outside the Denver office
ChartchartBar chart of monthly visits, rising from January to June
Logo linking homelogo.pngExample Co home page

Some practical rules:

  • Describe what matters in context. The same photo of a kitchen might be described by its layout on a renovation page and by its countertop material on a stone supplier's page.
  • Skip "image of" and "picture of". Screen readers already announce that it is an image.
  • Linked images need alt text that describes the destination, because the alt acts as the link text.
  • Decorative images get an empty alt: alt="". This tells screen readers to skip them. Leaving the attribute out entirely is different and can cause some readers to announce the file name.
  • Do not stuff keywords. If the keyword describes the image, it will fit naturally.
<!-- Meaningful image -->
<img src="/images/blue-trail-running-shoe.webp"
     alt="Blue lightweight trail running shoe, side view"
     width="800" height="600">

<!-- Decorative divider -->
<img src="/images/wave-divider.svg" alt="">

Use descriptive file names

Google has said file names can give it light clues about an image's subject. More importantly, a clear name makes your media library manageable. Compare DSC_0042.jpg with oak-dining-table-6-seater.jpg.

  • Use lowercase words separated by hyphens, not underscores or spaces.
  • Keep it short and specific: three to six words is usually enough.
  • Rename before uploading, because many CMSs bake the file name into the URL and changing it later breaks links.
  • Avoid non-ASCII characters and spaces, which get percent-encoded into ugly URLs.

Place images where search engines can find them

  • Use the HTML img element (or picture). Google has stated it does not index CSS background images for image search.
  • Put images near relevant text. Captions and nearby paragraphs give context that alt text alone cannot.
  • Check robots.txt is not blocking your image folder or CDN host.
  • Consider an image sitemap or image entries in your existing sitemap if images load in ways crawlers might miss, such as through JavaScript galleries.
  • Keep image URLs stable. Changing them often makes search engines rediscover and reprocess them.

Choose the right format

FormatBest forNotes
AVIFPhotos, complex imagesOften the smallest files; encoding is slower; supported by current major browsers.
WebPPhotos and graphicsUsually much smaller than JPEG or PNG; supports transparency; very broad support.
JPEGPhotos (fallback)Universal support; no transparency.
PNGScreenshots, graphics needing lossless qualityCan be large for photos; use only when you need lossless output.
SVGLogos, icons, simple illustrationsVector, scales without blur, tiny when simple. Sanitize uploaded SVGs, since they can contain scripts.
GIFRarelyAnimated GIFs are heavy; a short muted video is usually far smaller.

The format itself is not a ranking factor. What matters is the effect on load time. You can serve a modern format with a fallback using picture:

<picture>
  <source srcset="/images/oak-table.avif" type="image/avif">
  <source srcset="/images/oak-table.webp" type="image/webp">
  <img src="/images/oak-table.jpg" alt="Oak six-seater dining table"
       width="1200" height="800">
</picture>

Get the size right: dimensions and file weight

The most common image mistake is uploading a 4000-pixel-wide camera photo and displaying it in an 800-pixel column. The browser downloads every pixel, then scales it down.

Resize to the display size

Export images at roughly the largest size they will display, allowing for high-density screens (often about twice the CSS width). Then let the browser pick an appropriate file with srcset and sizes:

<img src="/images/oak-table-800.webp"
     srcset="/images/oak-table-400.webp 400w,
             /images/oak-table-800.webp 800w,
             /images/oak-table-1600.webp 1600w"
     sizes="(max-width: 600px) 100vw, 800px"
     alt="Oak six-seater dining table" width="800" height="533">

Compress sensibly

For lossy formats, moderate quality settings usually look identical to the original at a fraction of the weight. Compare visually at 100% zoom rather than chasing a number. Strip unnecessary metadata, but be aware that removing all EXIF data also removes copyright and orientation information, so keep what you need.

Measure the result

Run important pages through a Page Size Checker to see total page weight, and through a Page Speed Checker to see Core Web Vitals and image-specific suggestions such as "properly size images" or "serve images in next-gen formats." Fix the largest files first; one oversized hero image often outweighs everything else on the page.

Protect Core Web Vitals

  • Always set width and height. The browser reserves space before the image loads, preventing layout shifts that hurt CLS. CSS like max-width: 100%; height: auto; keeps it responsive.
  • Lazy-load images below the fold with loading="lazy".
  • Do not lazy-load the LCP image. The hero or main product image is often the Largest Contentful Paint element; lazy-loading delays it. Load it normally and consider fetchpriority="high".
  • Serve images from a fast host or CDN with long cache lifetimes for files whose names change when their content changes.
<!-- Hero image: load early -->
<img src="/images/hero.webp" alt="Workshop with handmade oak furniture"
     width="1600" height="900" fetchpriority="high">

<!-- Gallery further down: load later -->
<img src="/images/oak-chair.webp" alt="Oak dining chair with woven seat"
     width="600" height="600" loading="lazy">

Captions, titles and structured data

Alt text is not the only text that helps. Captions are among the most-read text on a page, so a short figcaption-style line under an important image (written as a normal paragraph if your editor does not support figures) adds context for readers and search engines alike. The title attribute, by contrast, adds little: it shows only on mouse hover, is ignored by many screen readers and is not a substitute for alt text.

For product, recipe and article pages, structured data can reference images too. Product markup with an image property, for example, can make your photos eligible to appear with product details in search features. Make sure the images in markup are the same ones shown on the page, are crawlable, and are large enough; Google's structured data documentation lists minimum sizes and aspect ratios for some features.

Common image SEO mistakes

  • Every image on a page sharing the same alt text, often the page title.
  • Important text baked into images instead of written as HTML, which makes it harder to read on mobile, harder to translate and less accessible.
  • Product images loaded only by JavaScript after user interaction, so crawlers never see them.
  • Huge PNG photos where a WebP would be a fraction of the size.
  • Lazy-loading everything, including the hero image.
  • Stock photos with no context, which add weight but little meaning.

Next steps

  1. Pick your five highest-traffic pages and check them for oversized images and missing dimensions.
  2. Rewrite alt text for meaningful images; set alt="" on decorative ones.
  3. Convert large photos to WebP or AVIF and generate two or three sizes for srcset.
  4. Make sure the main above-the-fold image is not lazy-loaded.
  5. Set a naming convention so new uploads get descriptive file names from the start.

Frequently asked questions

How long should alt text be?
There is no official character limit for search engines, but many screen readers handle short descriptions best. Aim for one clear sentence or phrase, usually under about 125 characters, that captures what matters in the image. If an image needs a longer explanation, such as a complex chart, put that explanation in the surrounding text or a caption.
Should I put keywords in alt text?
Only when the keyword genuinely describes the image. A photo of a blue trail running shoe can naturally be described with those words. Stuffing a list of keywords into alt attributes harms accessibility and can be seen as spam, so describe the image first and let relevance follow.
Is WebP or AVIF better for SEO?
Neither format is a ranking factor by itself. Both usually produce smaller files than JPEG at similar visual quality, which helps page speed. AVIF often compresses further but can be slower to encode; WebP has slightly broader tool support. Many sites serve AVIF with a WebP or JPEG fallback.
Do CSS background images get indexed in image search?
Google has stated that it does not index CSS background images for Google Images. If an image carries meaning and you want it found in image search, place it in the HTML with an img element and proper alt text. Purely decorative backgrounds are fine in CSS.
Marketing Automation - New e-commerce features

Latest articles

All articles →