Marcus Andrey Study
Ler em português Library

Framework · Imagery · 3 min read

Alt text decision tree

The W3C's five questions, asked in order, that tell you what kind of image you have (text, functional, informative, complex or decorative) and so what its alt text should say, or whether it should be empty.

  1. 1Text?

    Repeated nearby or only a visual effect: empty alt. Otherwise the text itself.

    "Fresh at 7"
  2. 2Link or button?

    Say where it goes or what it does, not how it looks.

    "Basket", not "bag icon"
  3. 3Adds meaning?

    Simple: one sentence. Complex: short alt, full information in the text.

    "Map of the pick-up point"
  4. 4Decoration?

    Empty alt, and never leave the attribute out.

    alt=""
  5. 5Not sure?

    Go back to the image's job, or the W3C images tutorial.

    Decide, then write it down
Ask the five questions in order and stop at the first yes: the answer tells you what the alt text says.

Use it when

  • You write the copy for a screen and reach an image with no alt text in the spec.
  • A review finds "image", "photo" or a file name as alt text.
  • The team argues about whether an image is "decorative" and nobody can say why.

How to use it

  1. Does it contain text? If the same text is real text nearby, or the text is only a visual effect, use alt="". If the text has a function (an icon with a word), say the function. Otherwise put the text in the alt, word for word. Output: an alt, or alt="", for every image with text in it.
  2. Is it a link or a button? If it would be hard to tell what the link or button does without the image, say where it goes or what it does, not what it looks like. Output: "Basket", not "Shopping bag icon".
  3. Does it add meaning to this page? A simple photo or graphic gets a short description of what someone sighted takes from it. A chart, map or diagram gets a short alt that says what it is, and the full information in the text nearby. If the text nearby already says it, use alt="". Output: one sentence, or a pointer to the full information.
  4. Is it decoration, or not meant for people at all? Use alt="", and never leave the attribute out, because then some screen readers read the file name. Output: alt="" on every decorative image.
  5. Still not sure? The image's use isn't covered above. Go back to its job, or read the W3C images tutorial for more cases. Output: a decision you can explain, written in the design next to the image.

Worked example

The bakery's ordering app, run through the tree.

Image First yes Alt text
A photo of a chalkboard that reads "Fresh at 7" 1: text that isn't anywhere else "Fresh at 7"
The basket icon in the top bar 2: a button "Basket"
Hero photo of loaves cooling on the bakery's own rack 3: it shows the thing "Loaves of sourdough cooling on the bakery's rack in the morning"
A map of the pick-up point 3: complex "Map of the pick-up point", with the address and directions in the text below
A grain texture behind the headline 4: decoration alt=""

Watch out for

  • Leaving out the attribute. No alt at all is not the same as alt="": some screen readers read the file name.
  • Describing the link's picture. A functional image's alt is its destination or action.
  • Long, poetic alt on a decorative image. It slows people down and tells them nothing.
  • A chart with "chart" as alt and no data anywhere. The alt names it; the text nearby has to carry the numbers.

Template

Copy this into the spec next to each image, and fill it in with whoever chose the image.

Image: ...
1. Contains text?         no / yes: also as real text nearby → alt="" / visual effect only → alt="" / has a function → say the function / otherwise → the text itself
2. Link or button?        no / yes → where it goes or what it does: ...
3. Adds meaning here?     no / simple → one sentence: ... / complex → short alt + full information in the text at: ... / already in the text → alt=""
4. Decoration only?       no / yes → alt=""
5. Unsure?                job of this image (see Image role check): ...
Alt text: ...
Source
W3C Web Accessibility Initiative, An alt decision tree, and the Images tutorial it belongs to
Where to find it
Photography and Imagery in UX: Alt text that helps › Four kinds, four answers, Alt text workshop

"See on Amazon" links are affiliate links. As an Amazon Associate I earn from qualifying purchases, at no extra cost to you.

Saved only on this device.

↑ ↓ to move · Enter to open · Esc to close