Write alt text that gives readers the information they would miss if they couldn’t see the image. Alt text, short for alternative text, is the text a screen reader can read in place of an image. If the image itself is the only label for a link, use the alt text to tell readers where the link goes or what it does.
In a fictional grammar lesson, a diagram compares “The bell rang.” with “The bell rang, and the class began.” Brackets mark the clauses, and an arrow points to the comma and the word and. The page asks students to compare the two sentences, and the examples appear only in the diagram. Here’s the complete alt text you could enter in the image’s Alternative text field.
Simple sentence with one clause. “The bell rang.” Compound sentence with two clauses joined by a comma and the word “and.” “The bell rang, and the class began.”
A first draft might say “Two sentences in boxes, with brackets and an arrow.” That tells readers what the diagram looks like. To do the exercise, they also need the exact sentences, the number of clauses in each, and what the arrow points out. The revised alt text puts all three into words. Each clause in this example can stand on its own as a sentence. The comma and and show how the lesson joins them, one of the patterns in Purdue OWL’s guide to sentence punctuation.
For your own image, identify what the reader needs to get from it. Check for words they need to read, labels they need to match, quantities they need to compare, or steps they need to follow. Include a visual detail when it helps them do that. For example, the arrow matters here because it shows where the two clauses join, so the alt text names that connection. If you’re building a similar grammar lesson, see more examples of simple and compound sentences. For guidance on what to carry over from the visual, see the W3C Web Accessibility Initiative’s examples of informative images.
A caption is visible text that accompanies an image. It can give readers an instruction, identify a figure, or explain what to look for. Alt text supplies what a reader needs from the image itself. Here are two ways to present the same diagram.
| What the caption gives readers | Alt text |
|---|---|
| An instruction only. “Compare the number of clauses in the two sentences.” | Simple sentence with one clause. “The bell rang.” Compound sentence with two clauses joined by a comma and the word “and.” “The bell rang, and the class began.” |
| The full comparison. “The simple sentence ‘The bell rang.’ has one clause. The compound sentence ‘The bell rang, and the class began.’ has two clauses joined by a comma and the word ‘and.’” | HTML result: alt="" |
Either version gives readers both examples and the comparison. In the first, the image carries the information, so the alt text supplies it. In the second, the visible caption already gives readers everything they need, and the unlinked diagram adds nothing further. You can give the image empty alt text so a screen reader can skip it. The same applies to a purely decorative image, such as a small pencil graphic used as a divider. In HTML, use alt="". If you leave off the entire alt attribute, some screen readers may announce the filename. See the W3C alt text decision tree and its decorative image examples.
Suppose the lesson ends with a bar chart of how many learners correctly identified simple and compound sentences on three practice questions. Readers need the overall pattern and the counts so they can tell where the difference was largest. Give the chart a short overview and put the exact values in a text table beside it.
Alt text
Bar chart of correct answers on three sentence exercises. More learners identified simple sentences correctly on every exercise. Exact counts are in the table that follows.
| Exercise | Simple sentence | Compound sentence |
|---|---|---|
| 1 | 16 | 8 |
| 2 | 17 | 12 |
| 3 | 18 | 16 |
The table lets a reader work out that the gap was largest on Exercise 1, when eight more learners identified the simple sentence correctly. For your chart, check the categories, units, and values before writing the summary. Give readers the details they need to make the same comparisons someone can make by looking at the chart. The W3C guide to complex images shows several ways to provide that detail.
At the end of the grammar lesson, an image of a worksheet is the only thing inside a link to an online exercise. Use Practice identifying simple and compound sentences as its alt text. That tells readers what they’ll get when they follow the link. If it opens a PDF instead, use wording such as Open the sentence practice worksheet (PDF).
When the same link also contains visible text that already says what the link does, use alt="" for an image that adds no further information. If an informative image also serves as a link, make sure readers can get its teaching content in nearby text and know what the link opens. See the W3C examples of images used as links.
The original diagram still contains both sentences and the arrow. This time, the paragraph immediately before it gives both examples, counts the clauses, and explains the comma and and. The diagram still has no link. What goes in the alt field?
Answer: In the image editor, choose its decorative-image option if it has one. If it asks for alternative text directly, leave that field blank. Check the finished page’s HTML: the image should have an empty alt attribute, written alt="". Read the paragraph with the diagram covered. You can still give both example sentences and explain how the second one joins its clauses. If the paragraph gave only the clause counts, readers would still need the examples and the joining detail. Supply those in the alt text or add them to the visible lesson before using empty alt text.
We encourage you to share this article on Twitter and Facebook. Just click those two links - you'll see why.