Image Alt Text: W3C Decision Tree, Examples and Length
Alt text depends on the job the image does on the page, not on what the picture contains. The W3C Web Accessibility Initiative’s alt decision tree routes images to five categories: decorative, informative, functional, complex, and images of text. Each gets a different treatment, and the same image file can fall into different categories on different pages. WCAG 2.2 success criterion 1.1.1, Non-text Content (Level A), requires that non-text content have “a text alternative that serves the equivalent purpose” (W3C Understanding SC 1.1.1).
No WCAG success criterion sets a character limit for text alternatives. The Understanding document says that short and long text alternatives can be used as needed, and calls for a long description when a short one cannot present the same information, as with a chart or diagram. The practical targets come from the W3C tutorial and from WebAIM, covered in the length section below.
The five image jobs at a glance
| Job | What it does on the page | Alt treatment | W3C tutorial example |
|---|---|---|---|
| Decorative | Adds styling or ambiance, or repeats nearby text | alt="" | Border image, greenhouse photo used for ambiance |
| Informative | Conveys a simple idea in a phrase or sentence | Short alt stating the meaning | Telephone icon: alt="Telephone" |
| Functional | Is the link or button, or part of one | Alt names the destination or action | Printer icon: alt="Print this page" |
| Complex | Carries data or relationships (chart, diagram, map) | Short alt that identifies it, plus the full information in text on the page | Bar chart with long description |
| Image of text | Shows words as pixels | Alt repeats the words in the image | Slogan: alt="Your access to the city." |
The W3C images tutorial lists seven image types in all; the two not in the table are groups of images and image maps, and groups are treated near the end of this page. The examples above come from the W3C pages for informative, decorative, functional, complex and textual images.
The W3C decision tree, step by step
The WAI alt decision tree asks its questions in a fixed order. The order matters, because an image that contains text is handled before the other tests.
- Does the image contain text? If the same text also appears as real text nearby, or the text is only for visual effect, use an empty
alt. If the text has a function, such as an icon, convey the function. If the text appears nowhere else, put the image’s text inalt. - Is the image in a link or button, so that the control would be hard or impossible to understand without it? Use
altto convey the link destination or the action taken. - Does the image add meaning to the page? A simple graphic or photo gets a brief description that conveys that meaning. A graph or other complex information goes elsewhere on the page in text. If the image repeats nearby real text, the alt is empty.
- Is the image purely decorative or not intended for users? Use an empty
alt. - Is the use not covered, or is the right text unclear? The tree does not cover every case; consult the full tutorial.
A common slip is skipping step 2 and describing the picture inside a link. A magnifying-glass icon in a search button should be named for what the button does, “Search”, not for what the icon looks like.
Informative images: state the meaning, not the pixels
W3C describes an informative image as one that conveys “a simple concept or information that can be expressed in a short phrase or sentence.” The alternative gives the meaning the image shows in context, which is usually not a literal description. The tutorial’s own examples show the range:
- Icons that label other information: a telephone icon beside a number gets
alt="Telephone", a fax icon getsalt="Fax". - A photo that supplements text: a dog wearing a bell gets
alt="Dog with a bell attached to its collar." - A diagram with succinct information: a bottle cap diagram gets
alt="Push the cap down and turn it counter-clockwise (from right to left)". - An image that conveys an impression: a family photograph gets
alt="We're family-friendly.", the point of the picture rather than a list of the people in it. - File-format icons inside download links:
alt="HTML",alt="Word document"andalt="PDF".
The bottle cap example shows why context decides the text. In an instruction leaflet the alternative carries the instruction. In a catalogue that already prints the instruction below the image, the same diagram could be decorative.
Phrases to drop
WebAIM advises leaving out wording such as “image of” or “graphic of”, because screen readers already announce that an element is an image, and avoiding repetition of the caption or surrounding text (WebAIM: Alternative Text). WebAIM also offers a quick test: ask what you would put in the image’s place if you could not use the image. If the answer is nothing, an empty alternative is likely enough.
Decorative images: an explicit empty alt
Decorative images add no information, so assistive technology should ignore them. SC 1.1.1 requires purely decorative content, content used only for visual formatting, and invisible content to be implemented so that assistive technology can ignore it. The W3C decorative-image tutorial gives these techniques:
alt="", with notitleattribute (WCAG technique H67). Screen readers skip the image. Keep the quotes empty: W3C’s image tips warn that some screen readers still announce an image when a space sits between them.- A CSS background image, which W3C names as the preferred method where feasible.
<hr>for a thematic break, such as a scene change, so that assistive technology is notified of the break.role="presentation", which the tutorial lists as an alternative that is less widely supported than a nullalt.
<img src="section-divider.png" alt="">
Leaving off the alt attribute entirely is a different situation. WCAG failure F65 covers img, area and input type="image" elements that carry none of alt, aria-labelledby, aria-label or title, and the decorative tutorial warns that some screen readers then announce the file name (F65). A name such as images/nav01.gif tells the listener nothing.
The tutorial’s decorative examples are a border, a crocus-bulb illustration inside a link whose text already names the destination, a sleeping dog beside text that explains it, and a greenhouse photo added for ambiance. In each case, the reason the image is on the page is what makes it decorative. Reuse the same dog photo on a card with no adjacent text and it may need real alt text.
Functional images: name the action or destination
A functional image triggers something. W3C says the alternative should describe the action or destination, not the picture, and that when a functional image has a missing or empty alternative, screen readers typically announce the file name, the image URL or the link’s URL instead (functional images). WebAIM states the same rule for links: when an image is the only content of a link, an empty alt is never appropriate.
| Situation | Alt text | Why |
|---|---|---|
| Logo as the only content of a link to the W3C home page | W3C home | ”home” is added because navigation is the logo’s job here |
| Logo inside a link that also has the visible text “W3C Home” | alt="" | The visible text already names the link |
| New-window icon after the link text “W3C Homepage” | new window | The icon adds information the text lacks |
| Printer icon that runs a print action | Print this page | Names the action |
| Magnifying-glass icon in an image submit button | Search | Names the purpose of the button |
Where possible, leave “link to” and “click here” out of the alt: WebAIM notes that screen readers already announce links as links, and W3C’s Easy Checks say the same of the words “button”, “link” and “image of”. Credits, file names and keywords do not belong in the name of a control. For the wider question of how controls are exposed to assistive technology, see Screen Reader Compatibility.
Complex images: a short alt plus the information in text
Charts, diagrams and maps need two parts: a short description that identifies the image, and a long description that gives the essential information. W3C recommends making the long description visible to everyone, not just assistive technology users, and referring to the image from the surrounding text (complex images). WebAIM’s rule for the short part is that it should still describe the general content of the image while the full alternative lives elsewhere, for example in an adjacent data table or on a linked page.
The tutorial’s example is a bar chart of website visitors, with the alt text “Bar chart showing monthly and total visitors for the first quarter 2025 for sites 1 to 3.” The scales, values and trends follow in a long description. W3C shows several ways to attach it:
| Technique | How it works | Limits |
|---|---|---|
| Location in the alt text | Alt says where the description sits on the page | The location must be stated clearly and accurately so users can find it |
| Adjacent text link | A link next to the image goes to the description | Link is not tied to the image in markup |
figure and figcaption with a link | Groups the image and link semantically | Add role="group" for browsers without native figure semantics |
figure and figcaption holding the full description | Headings, text and a table sit inside the caption | Same role="group" addition; the whole description is visible to everyone |
aria-describedby | Points the image at a paragraph by id | Read as one continuous paragraph, with no headings or tables, so suited to text-only descriptions |
When the data is tabular, put a table beside the chart, with units and the reporting period, and keep the chart’s alt as a pointer. Update the alt, the summary sentence and the table in the same edit, so the three never disagree.
Images of text
Real text styled with CSS is the first choice. W3C notes real text can be resized without losing clarity and recoloured by users, and says to use an image of text only in rare cases, with an alternative that holds the same words as the image (images of text). The related criterion, SC 1.4.5 Images of Text, is Level AA. It allows an image of text when users can customize its font, size, colour and background, or when a particular presentation is essential, and logotypes count as essential (Understanding SC 1.4.5).
W3C’s examples:
- A styled slogan image:
alt="Your access to the city.", with CSS and an embedded font suggested as the better build. - An unlinked logo:
alt="Web Accessibility Initiative". - An image of a recurring decimal:
alt="0.3333 recurring. (The recurrence is indicated by a line over the ‘3’ in the fourth decimal place)". For mathematics the tutorial prefers MathML to images.
A linked logo changes category and becomes a functional image, so its alt names the destination. For contrast and readability of real text, see Color Contrast Checker.
How long should alt text be?
The standards leave length to judgment, and the guidance is consistent about the shape of the answer.
| Source | What it says |
|---|---|
| WCAG 1.1.1 Understanding | Short and long text alternatives can be used as needed; a chart or diagram whose information a short one cannot present also gets a long description |
| W3C informative images | Informative images convey a concept that can be expressed in a short phrase or sentence; a short alternative is enough for an image that supplements nearby text |
| W3C image tips | Alt text should be “the most concise description possible of the image’s purpose”; if more than a short phrase or sentence is needed, use a long description method |
| WebAIM | ”Typically, only a few words are necessary, though rarely a short sentence or two may be appropriate”; when a complex image’s alternative will not fit a succinct alt, “perhaps a couple sentences in length”, it goes elsewhere |
A rough scale follows from those statements: a word or two for icons and labels, a phrase or one sentence for a photo or diagram, and anything longer moved into visible text. The W3C informative examples sit in that range, from one-word labels such as “Telephone” to the 68-character bottle-cap instruction, and the star-rating alt in the groups example below, “3.5 out of 5 stars”, has 18 characters.
Neither WCAG nor the W3C images tutorial gives a character count. A checking tool may set its own threshold: WebAIM’s WAVE raises a “Long alternative text” alert when an alt value passes 100 characters, and its documentation calls that limit “a rough and somewhat arbitrary length”, adding that longer alt text may be appropriate for images that present complex content or lengthy text (WAVE documentation).
When the information needs more than a short phrase or sentence, W3C treats the image as complex, and the answer is to add text to the page rather than to lengthen the attribute.
Groups of images and other cases
One idea across several images. A star rating built from five star images conveys a single fact. W3C’s groups tutorial puts the description on the first image (“3.5 out of 5 stars”) and gives the rest alt="".
A collection of related items. Each image gets its own alternative that also conveys how it relates to the others. W3C shows nested figure elements with figcaption and role="group", noting that support for that role varies.
Language. The SC 1.1.1 Understanding document says text alternatives should match the human language of the original content, normally the page’s default language.
A review routine for editors
- List every image on the page, including card thumbnails, logos and icons inside links.
- Walk the decision tree for each one and write the decision next to it: decorative, informative, functional, complex or text.
- Read the alts in page order together with the visible text. Delete repetition, “image of” openings and file names.
- For each complex image, confirm the long description is on the page and the short alt points to it.
- Inspect image-only links and buttons in the browser’s accessibility tree and confirm each has a name.
- Re-check at a narrow viewport; hidden link text changes which image needs the name.
For a screenshot, describe only what the reader needs: the control and its state, with procedures in ordinary text. For video, the equivalent work happens in captions, audio description and transcripts. For the standard as a whole, see WCAG 2.2 explained.
W3C’s Easy Checks put the limit of automation plainly: automated tests can tell you if alt is missing, but judging whether the text is appropriate means seeing the image in context. Pattern checks catch some placeholders: WAVE’s suspicious alternative text alert covers values such as “image” and “spacer”, which WCAG failure F30 lists as placeholder text that fails SC 1.1.1. A fluent but wrong description passes every such check, so each image still needs the human decision recorded above.
Sources
- W3C WAI: An alt decision tree
- W3C WAI: Informative images
- W3C WAI: Decorative images
- W3C WAI: Functional images
- W3C WAI: Complex images
- W3C WAI: Images of text
- W3C WAI: Groups of images
- W3C WAI: Images tutorial, tips and tricks
- W3C WAI: Easy Checks, image text alternatives
- Understanding SC 1.1.1 Non-text Content
- Understanding SC 1.4.5 Images of Text
- WCAG failure F65
- WCAG failure F30
- WebAIM: Alternative Text
- WebAIM: WAVE documentation, long and suspicious alternative text alerts