Back to blog

How to write useful alt text for website images

Learn how to decide what each image needs: when to describe it, explain its function, or leave its alternative text empty.

5 min read
Person reviewing images and alternative text in an accessible web interface

Alternative text for an image is not a label for repeating keywords or an automatic account of everything visible in a photo. Its job is to help preserve the meaning of content when the image cannot be perceived. To decide what to write, first ask what the image contributes to that page.

The same image may need different alternative text depending on context. A picture of a mug might be decorative in an article about work habits, but informative in a shop where the product is for sale. That is why each image should be assessed when it is published, rather than handled with one formula across the entire site.

Start with purpose, not appearance

Look at the image in the page and ask: if I could not see it, what information, action, or meaning would I miss? The W3C Web Accessibility Initiative’s images tutorial distinguishes, among other cases, informative, decorative, functional, and complex images. These categories help avoid a description that sounds precise but does not meet the reader’s need.

  • Informative: adds a fact or idea not expressed elsewhere.
  • Decorative: supports the design but adds no necessary information.
  • Functional: activates a link or control; what it does matters.
  • Complex: presents detailed information, such as a chart, that should also be available in text.

What to write for each image type

Informative images: convey what matters

Describe the aspect that helps someone understand the content, not every visible detail. If an image shows a chart about website visits, the alternative text should summarize the important trend; simply saying “line chart” is not enough. If it shows someone using a tool and the article explains that use, mention the action that provides context.

Before drafting, identify the idea the page needs to communicate. Then write a short, natural phrase that conveys it. There is no need to begin with “image of” or “photo of”: the reader already encounters a graphic element. Avoid details that do not help explain the content.

Decorative images: avoid adding noise

If an image is purely ornamental, its alternative text can be empty: alt="". This signals that it does not need a description; it does not mean omitting the attribute. Adding text such as “blue decorative line” can distract from important information. If an image contains words that are already fully shown nearby, repeating them may also be unnecessary.

Images that act as links or buttons

If the image is the only content in a link or button, describe its destination or action, such as “Go to the contact page” or “Search.” Do not merely describe the icon, as in “magnifying glass,” if the control’s purpose is to search. When a link already has visible text explaining its function, check whether the image repeats that information; an empty alternative may prevent duplication.

Charts and images containing text

If an image contains text that is not available elsewhere, make sure that information is provided in the alternative text or nearby content. For a complex chart, a short phrase can identify it, but its relevant data and findings should also be explained in the page, perhaps through a table, summary, or other text equivalent.

Decision diagram for choosing image alt text based on its purpose on a page
The key question is not “what do I see?” but “what does someone who cannot see this image need to know?”
Decision diagram for choosing image alt text based on its purpose on a page
Before writing a description, identify the role the image plays on that page.

A quick process for reviewing each image

  1. Read the surrounding content. Identify what information is already written.
  2. Determine the purpose. Does the image inform, decorate, trigger an action, or present complex data?
  3. Choose the right response. Write a useful description, state the function, use alt="" if it is decorative, or provide complex information in text.
  4. Try reading without the image. Read the alternative text with the surrounding content and check that it makes sense without needless repetition.
  5. Check the published page. Confirm the field was saved and was not left empty by mistake on an informative image.

Common mistakes to avoid

  • Repeating the file name: “IMG_4832” does not explain what the image contributes.
  • Stuffing in keywords: text should help people understand, not act as a search-term list.
  • Describing everything: a list of colors, objects, and positions can hide the relevant point.
  • Using the same text for every image: each image may serve a different purpose on each page.
  • Confusing description with action: for a button, explain what happens when it is activated.
  • Leaving essential chart information out: naming a chart does not replace presenting its data or findings.

WAI’s alt attribute decision tree offers a structured way to resolve uncertain cases. It asks whether the image contains text, whether it is needed to understand a link, and whether it adds meaning in context. It is a useful reference when you are unsure whether to describe an image or mark it as decorative.

The most useful description is not the longest one; it is the one that preserves the information or function the image contributes to the page.

Make review part of publishing

To get started, choose an important page and review its images one by one. Note which convey information, which are decorative, and which enable an action. Fix images that contain data or form links without text first, then add this review to your publishing routine. That way, alternative text stops being a field filled in at random and becomes part of clearer, more accessible content.