Good alt text replaces an image with the words a reader would need if they could not see it, and that depends on why the image is there. A logo that links home needs the destination, a chart needs its finding, and a decorative flourish needs nothing. Below are bad and good alt text examples for each kind of image.
The rule every example follows
Alt text is required by WCAG 2.2 Success Criterion 1.1.1, Non-text Content, which sits at Level A, the most basic level of the standard. It asks that all non-text content presented to the user has a text alternative that serves the equivalent purpose. The phrase that matters is equivalent purpose. Alt text is not a caption and not an inventory of pixels: it is whatever does the image’s job for somebody who hears the page through a screen reader, reads it in a braille display, or loads it with images turned off.
The W3C’s images tutorial sorts images by that job, and the examples below follow its categories: informative, functional, decorative, images of text, and complex images. The same photograph can fall into different categories on different pages, which is why the W3C says the choice between informative and decorative is a judgment only the author can make.
| Kind of image | What the alt text carries | Typical example |
|---|---|---|
| Informative | The meaning in a short phrase or sentence | A photo that supports a story |
| Functional | The action or destination | A linked logo, an icon button |
| Decorative | Nothing: an empty alt attribute | A divider, a background flourish |
| Image of text | The same words as the image | A slogan set in a picture |
| Complex | A short identification, with the detail elsewhere | A chart, a map, a diagram |
Alt text examples, bad and good
Each row gives an image in its context, the alt text it often gets, and a version that does the image’s job. The functional rows use the W3C’s own examples.
| Image, in its context | Bad alt text | Good alt text |
|---|---|---|
| Company logo linking to the home page | logo.png | Example.com homepage |
| Magnifying glass icon on the search button | Magnifying lens | Search |
| Printer icon that prints the page | Printer | Print this page |
| Telephone icon before a phone number | Icon | Telephone |
| Team photo on an About page | Image of people | The six members of the support team outside the Leeds office |
| Product photo on a shop page | Shoe | Trail running shoe in grey mesh with an orange sole, side view |
| Photo beside a news story about a flood | Picture of water | Flooded high street in Hebden Bridge, with water up to shop windows |
| Banner reading Free delivery this week | Banner | Free delivery this week |
| Bar chart of sign-ups by month | Chart | Monthly sign-ups, January to June, rising every month; full figures in the table below |
| Decorative wave between two sections | Blue wave graphic | (empty: alt="") |
| Headshot next to a quote that already names the person | Photo of Jane Smith | (empty, because the name is in the text beside it) |
| Screenshot in a how-to article | Screenshot | Screenshot of the Settings page with the Export button highlighted |
The bad column fails in three distinct ways. File names and words like logo, icon or banner tell a listener nothing. Literal descriptions such as magnifying lens describe what the image looks like when the reader needed what it does. And phrases like image of repeat what the screen reader has already announced.
Functional images: name the action, not the picture
Functional images are the ones a user clicks or presses: linked logos, icon buttons, image links. The W3C functional images tutorial is direct about them. The text alternative should convey the action that will be initiated, not describe the image, so print this page rather than printer, search rather than magnifying lens, and Example.com homepage rather than Example.com logo.
Missing alt text hurts most here. The tutorial notes that when a functional image has no text alternative, screen readers typically announce the image file name, the image URL or the link destination instead, none of which tells the user what pressing it will do. A close button drawn as an X with no name becomes a puzzle at the moment the user is trying to leave a dialog.
The same rule covers icons inside link text. If a link reads Download the report and carries a small PDF icon, the icon can say PDF, so the link is announced as Download the report PDF. If the visible text already says everything, the icon is decorative and its alt is empty. Where an icon is not an image element at all, such as an inline SVG or an icon font, the name comes from an aria-label or from visually hidden text instead.
Decorative images: when the right alt text is empty
The W3C decorative images tutorial lists the images that usually need no text: visual styling such as borders, spacers and corners; images that only enlarge a link’s clickable area; eye candy that illustrates nearby text without adding information; and images already identified by the text around them. For these the right value is an empty alt attribute, alt="", so that assistive technology skips the image.
Two details trip teams up. Empty is not the same as missing. The tutorial explains that when the alt attribute is left out entirely, some screen readers announce the file name, so a decorative divider becomes wave-divider-final-v2.svg read aloud. And empty means truly empty: a single space, or alt text of decoration, puts noise back in.
The headshot row in the table is the subtle case. A photo next to a quotation that already names the speaker adds nothing a listener lacks, so describing it makes the reader hear the name twice. The decision tree in the same tutorial asks exactly this: does the image show content that is redundant to real text nearby? If so, the alt is empty.
Images of text and complex images
An image that contains words needs those words as its alt text. The images of text tutorial also recommends not using them at all where styled real text would do, because real text can be resized without losing clarity and recolored to suit the reader, and an image of text blurs and pixelates. Promotional banners, quotes set as pictures and text baked into hero images are the usual offenders, and each one is a sentence a screen reader user never hears unless it is in the alt.
Charts, maps and diagrams hold more than a sentence can carry. The complex images tutorial calls for a two-part text alternative: a short description in the alt that identifies the image and, where useful, says where the long description is, and a long description that gives the essential information in text. For a chart the long description is often a data table placed under it, which also helps every sighted reader who wants the exact figures. The chart row in the table above does both jobs: it states the finding and points to the table.
Checking and fixing alt text on a live site
Alt text is easy to audit badly. An automated scanner can find images with no alt attribute at all, but it cannot tell whether Search is right for a button or whether a photo is decorative on this page. That needs a person reading each image in context, which the accessibility checklist builds into its pass, and listening to the page, which is covered in screen reader testing. The wider method sits under accessibility testing.
A quick review goes page by page through four questions taken from the W3C decision tree. Does the image contain text that appears nowhere else? Is it inside a link or a button? Does it add meaning to this page? Is it there only for decoration? Each answer points to one row of the table above.
When an image is wrong, the fix is usually a one-line change, and the hard part is telling the person who can make it which image, on which page, in which state. A report filed from the page with a feedback widget carries the URL and a screenshot with the image marked, and evidence capture adds the browser and the console, so the developer finds the element without hunting and the writer can see the context the new alt text has to fit.