1. Home
  2. Guides
  3. Image alt text
Accessibility guide

Image alt text: how to write it for accessibility and SEO

Alt text is the written alternative to an image. It is read aloud by screen readers, shown when an image fails to load, and used by search engines to understand pictures. Good alt text is short, specific and written for the context.

Key points

  • Every <img> needs an alt attribute. Informative images get a description, decorative ones get an empty alt="".
  • Describe what the image communicates in context, not everything that is visible.
  • A missing attribute is different from an empty one: without alt, screen readers may read the file name.

What alt text is for

The alt attribute provides a text alternative for an image:

<img src="/img/support-team.jpg" alt="Three members of the support team answering chats at their desks">
  • Screen-reader users hear the alt text in place of the image.
  • Everyone sees it if the image fails to load on a slow or blocked connection.
  • Search engines use it, with the surrounding text and file name, to understand what an image shows. It is one signal for image search.

Providing text alternatives for non-text content is a basic requirement of the Web Content Accessibility Guidelines (WCAG, success criterion 1.1.1), and in many places a legal expectation for public websites.

Informative or decorative?

Decide first whether the image carries information.

Image typeWhat to doExample
Informative photo or illustrationDescribe what it shows and why it is therealt="Bar chart: signups doubled between March and June"
Decorative (dividers, backgrounds, repeated icons next to text)Empty alt, so it is skippedalt=""
Image used as a link or buttonDescribe the destination or action, not the picturealt="Download the pricing PDF"
LogoThe organisation name (and “home” if it links home)alt="WebsiteHealthLabs home"
Image of textThe same text, or avoid text in imagesalt="Free shipping on orders over 50"
Complex chart or diagramShort alt plus a longer description nearbyAlt gives the takeaway; the text or a table gives the data

Empty is not the same as missing. alt="" tells assistive technology “skip this”. Leaving the attribute out entirely means a screen reader may announce the file name instead, and validators flag it.

How to write good alt text

  • Be specific and concise. There is no hard character limit, but one short sentence or phrase is usually enough.
  • Write for the context. The same photo of a laptop needs different text in a product page and in an article about remote work.
  • Do not start with “image of” or “picture of”. Screen readers already announce that it is an image.
  • Do not repeat the caption or surrounding text. If the text next to the image says it all, use an empty alt.
  • Do not stuff keywords. “Shoes cheap shoes buy shoes online” is useless to a listener and can look spammy to search engines.
  • Include text that appears in the image when it matters, such as a button label or a sign.
WeakBetter
alt="IMG_4023.jpg"alt="Barista pouring latte art into a white cup"
alt="image of a graph"alt="Line graph: page load time fell from 4.1 s to 1.9 s after image optimisation"

Other details

  • CSS background images have no alt text. If one carries meaning, use an <img> or add the information as real text.
  • SVG: use role="img" with an aria-label or a <title> for informative graphics, and aria-hidden="true" for decorative ones.
  • File names and titles are secondary signals. A descriptive file name helps a little; it does not replace alt text.

What the audit checks

The audit counts images without an alt attribute. Images with an empty alt are treated as intentionally decorative and do not count as problems. Lighthouse's accessibility checks add further tests, for instance for images used as links. Automated tools can check that alt text exists, but not that it is a good description. That part needs a person.

See also: Accessibility basics, Open Graph and social previews.

FAQ

How long can alt text be?

There is no fixed limit in the HTML or WCAG specifications. Keep it as short as it can be while conveying the image's purpose. Long explanations belong in the page text.

Does alt text help SEO?

It helps search engines understand images and is useful for image search. It also acts as the anchor text when an image is the only content of a link. Write it for people first.

Should every image have alt text?

Every image needs an alt attribute. Decorative images should have an empty one. Only images that convey information need a written description.

WebsiteHealthLabs Editorial
Guides explain audit results in plain English. Facts are checked against public documentation from Google, W3C and the browser vendors, and we update them when guidance changes.

↑ ↓ to moveEnter to openEsc to closeAll results