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.
- 1Text?
Repeated nearby or only a visual effect: empty alt. Otherwise the text itself.
"Fresh at 7" - 2Link or button?
Say where it goes or what it does, not how it looks.
"Basket", not "bag icon" - 3Adds meaning?
Simple: one sentence. Complex: short alt, full information in the text.
"Map of the pick-up point" - 4Decoration?
Empty alt, and never leave the attribute out.
alt="" - 5Not sure?
Go back to the image's job, or the W3C images tutorial.
Decide, then write it down
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
- 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, oralt="", for every image with text in it. - 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".
- 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. - 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. - 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
altat all is not the same asalt="": 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: ...
- A Web for Everyone: Designing Accessible User ExperiencesSarah Horton and Whitney QuesenberyBook · 2014 (Amazon)
- Accessibility for EveryoneLaura KalbagBook · 2017 (Amazon)
- An alt decision treeW3C WAI (external site)
- Images tutorialW3C WAI (external site)
- Screen Reader User Survey #10WebAIM (external site)
"See on Amazon" links are affiliate links. As an Amazon Associate I earn from qualifying purchases, at no extra cost to you.