Skip to content
mentoor

Topic 1 of 6 · 4 min read

Alt text that fits the image's purpose

Goal: Judge AI-generated alt text against the image's purpose on the page, and rewrite it or mark the image as decorative.

Good alt text says what the image is for on this page, not everything that is in it. The same photo can need three different descriptions on three different pages, or none at all.

Check yourself · 1 of 3

An AI tool writes alt text for a purely decorative flourish line on a blog. What is the correct alt attribute?

Choose one answer

Why it matters

Alt text is the text a screen reader speaks in place of an image. It also shows when an image fails to load. People who are blind or have low vision rely on it to follow the page. Vision models such as ChatGPT, Claude and Gemini can describe a picture in seconds, but they see only the pixels. They do not know why you placed the image there.

How to do it

Ask one question first: what job does this image do here? The W3C alt decision tree sorts images into a few jobs.

  1. Informative. The image carries information. Write a short phrase that gives the same information.
  2. Functional. The image is a link or button. Describe the action, not the picture. A magnifying glass inside a search button is "Search".
  3. Complex. A chart or diagram. Give a short alt that names it, and put the full data in a table or text nearby.
  4. Decorative. The image adds nothing the text does not already say. Use an empty alt, written alt="", so screen readers skip it. Never leave the attribute out, because then some readers announce the file name.

Then give the model the job, not only the picture: the page, the nearby text and the purpose. Read the result and cut it down.

Before and after

Before (AI, no context): "A smiling woman in a blue jacket standing next to a bicycle on a city street with buildings in the background."

The image sits on a bike-repair shop's booking page, beside the line "Meet Ana, your mechanic."

After: "Ana, the shop's mechanic, with a customer's bike." Or, if the caption already names her, alt="".

What goes wrong

  • The model starts with "Image of" or "Picture of". Screen readers already announce an image, so this is noise.
  • It describes details that do not matter and misses the one that does, such as the text inside a screenshot or the trend in a chart.
  • It states things it cannot know: a person's name, mood, job or relationship. Models guess and sound sure.
  • Every image gets long alt text, so a page of decorative photos becomes a wall of speech.

Treat model output as a first draft. You know the page. The model does not.

Examples

One photo, two jobs

A photo of a loaded delivery van appears twice.

On a blog post about fleet costs, beside a paragraph that already explains the van fleet, the photo is decoration: alt="".

On a product page, where the photo shows the van's size and the cargo door, it is informative: "Delivery van with the rear door open, showing a 3-metre load floor."

Fixing an AI draft

The model returns: "Image of a bar chart with blue and orange bars." The chart shows sales by quarter, and the point is that Q4 doubled.

Rewrite: "Bar chart: sales by quarter, with Q4 about double Q3." Put the exact numbers in a table below the chart.

Key points

  • Alt text should serve the image's job on this page, not list its contents.
  • A model sees pixels; it does not know why you placed the image, so give it the page and the purpose.
  • Decorative images get an empty alt attribute, never a missing one.
  • An image used as a link or button needs alt text that names the action.
  • A model can invent names, emotions and details, so check every claim against what you know.

Common mistakes

  • Accepting the model's description without asking what the image is for.
  • Starting alt text with "Image of" or "Picture of".
  • Leaving the alt attribute off decorative images instead of setting it to empty.
  • Letting the model name people or guess feelings it cannot see.

Check yourself · 2 of 3

A photo of a laptop sits inside a link that opens the pricing page. The AI suggests: "Silver laptop on a wooden desk." What is the better alt text?

Choose one answer

Check yourself · 3 of 3

An AI tool drafted these alt texts. Which one makes a claim the model cannot know from the image pixels alone?

Choose one answer

Practice items, not counted towards your mastery.

Start here