Alt text examples, good and bad, by image type

Alt text examples for informative, functional, decorative, text and complex images: a bad and a good version of each, and the W3C rule behind every choice.

An empty clear glass picture frame stands on a short foot, with a small flat orange tablet lying on the stage in front of it

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 imageWhat the alt text carriesTypical example
InformativeThe meaning in a short phrase or sentenceA photo that supports a story
FunctionalThe action or destinationA linked logo, an icon button
DecorativeNothing: an empty alt attributeA divider, a background flourish
Image of textThe same words as the imageA slogan set in a picture
ComplexA short identification, with the detail elsewhereA 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 contextBad alt textGood alt text
Company logo linking to the home pagelogo.pngExample.com homepage
Magnifying glass icon on the search buttonMagnifying lensSearch
Printer icon that prints the pagePrinterPrint this page
Telephone icon before a phone numberIconTelephone
Team photo on an About pageImage of peopleThe six members of the support team outside the Leeds office
Product photo on a shop pageShoeTrail running shoe in grey mesh with an orange sole, side view
Photo beside a news story about a floodPicture of waterFlooded high street in Hebden Bridge, with water up to shop windows
Banner reading Free delivery this weekBannerFree delivery this week
Bar chart of sign-ups by monthChartMonthly sign-ups, January to June, rising every month; full figures in the table below
Decorative wave between two sectionsBlue wave graphic(empty: alt="")
Headshot next to a quote that already names the personPhoto of Jane Smith(empty, because the name is in the text beside it)
Screenshot in a how-to articleScreenshotScreenshot 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.

Common questions

What is a good example of alt text?

A good example of alt text says what the image means in its place on the page. For a photo of a dog in a high-visibility vest next to a story about guide dogs, Guide dog at work in a crowded station is better than Dog. For a linked logo it names the destination, such as Example.com homepage, and not the picture.

How long should alt text be?

Alt text should be as short as it can be while still carrying the image's purpose, usually a phrase or one sentence. The W3C tutorial describes informative images as ones whose meaning fits a short phrase or sentence. When an image holds more than that, such as a chart, the detail belongs in a long description on the page, not in the alt attribute.

When should alt text be empty?

Alt text should be empty, written as alt with two quotation marks and nothing between them, when an image is purely decorative or repeats text that is already next to it. The W3C images tutorial explains that an empty value lets screen readers skip the image, while leaving the attribute out makes some of them read the file name aloud.

Should alt text start with image of or picture of?

Alt text should not start with image of or picture of. Screen readers already announce the element as an image or graphic, so the phrase repeats information the listener has just heard. The exception is when the medium is the point, such as a screenshot, an illustration or a painting, where saying so tells the reader something the role does not.

What is the alt text for a button with only an icon?

The alt text for an icon-only button is the action the button performs, not a description of the icon. The W3C functional images tutorial gives search rather than magnifying lens, and print this page rather than printer. Missing alt text on such a button leaves screen reader users with a file name or a URL instead of an action.

Which WCAG rule requires alt text?

WCAG 2.2 Success Criterion 1.1.1, Non-text Content, requires a text alternative that serves the equivalent purpose for all non-text content presented to the user. It is Level A, the most basic level of conformance. Controls must have a name that describes their purpose, and decoration must be implemented so that assistive technology can ignore it.

The Notarus team

The people who build Notarus. We write up the decisions behind the product when the reasoning is worth more than the changelog line.

Keep reading

Reports with the evidence attached.

Start free, one script tag.

<script src="…/widget.js" data-key="pb_pub_…">