Skip to main content
WCAGrules
Quick navigation

Guides · Building it right

How to Write Alt Text That Actually Works

Working out which treatment an image needs is the hard part. The writing is easy after that.

Last reviewed August 31, 2026

Alt text is the requirement most often named in accessibility complaints, and it is also the one a machine can check the least. A scanner confirms an alt attribute exists. Some tools go further and flag alt text shaped like a filename, because that is a pattern rather than a judgment. None of them read the chart, so alt="chart" on a chart showing sales falling 40 percent clears the automated checks and tells your reader nothing.

W3C's Decision Tree, in the Order It Actually Asks

There is a published five-question funnel for this, and its first question is not the one people expect. It does not open on whether the image carries meaning. It opens on whether the image contains text, because that case has four different answers and the wrong one is expensive.

  1. Does the image contain text? Four branches. If the same words appear as real text nearby, the image takes an empty alt. If the text is purely a visual effect, empty alt. If the text has a function, such as an icon, describe the function rather than the letters. If the words appear nowhere else, put them in the alt, and read the section below about what that does and does not fix.
  2. Is the image inside a link or a button, and would removing it leave the purpose unclear? If so, the alt describes the destination or the action, not the picture.
  3. Does the image contribute meaning to the page? Three branches. A simple graphic or photograph takes a brief description conveying that meaning. A graph or other complex information needs the information written out elsewhere on the page. Anything redundant to nearby text takes an empty alt.
  4. Is the image purely decorative, or not intended for users at all? Empty alt. That second half covers tracking pixels and spacer images, which are not decorative in the design sense, they are invisible, and putting words on them only distracts.
  5. Anything else needs the full images tutorial, because W3C says outright that the tree does not cover every case.

The outcome is always one of two things, an alt text or an empty alt, and there is more than one mechanism for the second. W3C's preferred route for a decorative image is not alt="" at all. It is not putting the image in the HTML in the first place, and delivering it as a CSS background instead. role="presentation" is a third route and is less widely supported than an empty alt. And the failure that runs the other way is worth knowing. Information conveyed only by a CSS background image has no way to carry an alternative at all.

Where the Tree Comes From, and What Else Is On That Shelf

The tree is W3C's, and it lives inside the W3C images tutorial, which is one of six tutorials the accessibility group publishes. The other five cover forms, tables, page structure, menus and carousels. Between them they are the most practical writing W3C has done on this subject. Hardly anybody outside the field has opened one, because they sit two clicks off the standard and end up in bibliographies rather than in front of the person doing the work.

The images tutorial is nine pages, and the seven kinds of image in the next section are its categories rather than ours. It also carries the parts the decision tree has no room for. That an image carrying no alt attribute at all makes some screen readers read out the file name instead. That a long description attached with aria-describedby reaches a listener as one unbroken paragraph, with any headings and tables inside it flattened away. And that logos are exempt from the contrast and text-size requirements other images of text have to meet, which settles an argument most design teams have at least once.

One thing is worth knowing before you follow any of the six end to end. They deliberately combine success criteria and techniques from different conformance levels inside a single instruction, and W3C states that outright rather than leaving you to notice. Every tutorial page then lists the specific criteria it used, so you can check what level any given instruction sits at before committing to it. Follow one straight through and you may build past the level your law actually asks of you, which is a fine thing to do on purpose and a strange thing to do by accident.

The Kinds of Image, and What Each Needs

KindExampleWhat to write
InformativeA photo showing what a product looks likeA brief description of the meaning it carries
DecorativeA background flourish, a divideralt="", or better, a CSS background image
FunctionalA logo linking home, a magnifier in a search buttonThe destination or the action. Home, or Search
Text in an imageA quote graphic, a price badgeUsually the exact text, and see the warning below
ComplexA chart, a diagram, a mapA short alt naming it, plus the full information in the page
A group of imagesFive stars making one ratingOne alternative on one of them, alt="" on the rest
An image mapA floor plan with clickable roomsAn alternative on the image saying what it is, plus one on every hotspot saying where it goes
The seven kinds of image and what each needs

The last two are the ones our own list used to leave out, and both have their own group technique and hotspot technique. A clickable regional map or an organizational chart with hotspots is an image map in the standard's sense, and it needs alternatives in two places rather than one.

The warning that belongs on the fourth row

Putting the words of a quote graphic into its alt attribute satisfies the non-text content rule. It does nothing for 1.4.5 Images of Text, which is a separate Level AA rule wanting real text that somebody can resize, restyle and reflow. So a reader who follows that row has written good alt text on a compliance failure. The remedy is real text styled with CSS, or a control letting the user swap the image for text. Two rules, two fixes, and the alt text only ever answers one of them.

Then, the Words

Six rules cover nearly every case.

  1. Describe the purpose, not the picture. The same photograph gets different alt text on a travel site and on a university site, because what it is doing there is different. W3C's own paired example is an image of the world, described as International Travel in one place and International Campuses in the other.
  2. Skip image of and picture of. Screen readers generally announce that it is an image already, so you are making somebody hear it twice. That is convention rather than a rule, and it depends on verbosity settings, and it is still the right habit.
  3. Keep it to a sentence or so. There is no length threshold in the standard. What there is instead is a pattern. Where an image needs more than a sentence, that is the signal to write a short alt and put the detail in the page.
  4. Do not repeat the caption, and check what the image adds first. This one has an exception people trip on. A file-format icon inside a download link takes alt="PDF" even though the link text is right beside it, because the format is information the words do not carry. W3C's other worked example is a dog with a bell on its collar in an article about the dog, where the alt covers the bell and nothing else.
  5. End the thought. Alt text is a sentence somebody hears, so write it as one.
  6. Never use the filename. IMG_4471.jpg tells nobody anything.

That last one deserves precision, because two different failures get collapsed into it. Alt text that is a filename fails because the text cannot stand in for the image, and the test is loss of information rather than the presence of a file extension. An image with no alt attribute at all is a different failure, and it is the one that actually makes some screen readers read the file name out. So the automated rule that used to test filenames as names has been retired, and alt="dog.jpg" on a photograph of a dog was never automatically a failure. Our own checker flags a file extension because it is a useful signal, not because the extension is the rule.

There is a failure in the other direction too, and it has its own number. Junk alt on a decorative image, so alt="spacer" or alt="image" on something that should be ignored, is distinct from leaving the attribute off. Useful to know when a developer disputes the finding.

Worked Examples

ImagePoorBetter
A blue kettle on a product pagealt="kettle"alt="Cordless kettle in matte blue, 1.7 litre, with a black handle"
A bar chart of quarterly salesalt="sales chart"alt="Quarterly sales fell from $1.2m in Q1 to $720k in Q4", with the figures in a table below
A logo that links homealt="logo"alt="WCAGrules home"
A logo inside a link that already says Homealt="WCAGrules home"alt="", because the link text carries it and the image is a visual cue
A magnifier icon in a search buttonalt="magnifying glass"alt="Search"
A team photo on an About pagealt="team"It depends, and the next paragraph is about why
A quote graphicalt="quote"The exact quoted text, and then go and make it real text
The same images, done badly and done well

The team photo is the row we changed our minds about, and it is the row most likely to be copied, so it is worth being careful. We used to say alt="" on the grounds that it illustrates rather than informs. W3C's directly comparable example runs the other way. A photograph of a family on a company's website is treated as informative, with the alt text We are family-friendly, because the impression the picture creates is the content.

Both answers are defensible and the deciding test is published. An image is decorative when it illustrates adjacent text without adding information, or when the surrounding text already identifies and describes it. A team photo under a heading naming the team meets that and takes an empty alt. A team photo standing alone as the only thing on the page arguing that a real group of people works here does not, and giving it an empty alt deletes the content.

The two-second test, and what it misses

Read the page with images turned off. If the alt text tells you what the image told you, it is right. Three things it will not catch. It cannot tell a deliberate alt="" from a missing alt attribute, and those are different failures. It cannot spot a logo announcing its destination twice inside link text that already says it, because that is a duplication rather than an absence. And it does not apply to an inline SVG at all, which is not an img and has its own problem, since some browser and screen reader pairs do not pronounce an svg element's accessible name unless you add an explicit role="img". Our decision helper walks the choice with you.

Charts, Infographics and Anything Complex

The pattern is two parts. A short alt naming what the thing is and, where it helps, saying where the fuller description lives. Then the detail, in the page itself, as a real table or as prose.

How you attach the second part matters more than people expect, and there are four published ways. A text link next to the image. A note inside the alt attribute saying where the description is. A figure with role="group" holding the description in its figcaption. Or aria-describedby for a description that is text only. That last one has a limit that rules it out for the most common case. A description attached that way is announced as one continuous paragraph, with no headings and no table structure, so a data table attached with aria-describedby arrives as an unbroken run of numbers. Use a link beside the image or put the description in the surrounding text.

One failure specific to charts, and it counts twice. Alt text that leaves out what the colors were carrying fails the non-text content rule and the use-of-color rule together. Sales by region, on a chart where each region is a color and the alt never says which is which, is the shape of it.

Putting a data table next to a chart is not a compromise for disabled users. It is usually the better page, and W3C's argument for it names who gains beyond screen reader users. People with low vision, people with learning disabilities, and anybody who is not already expert in the subject. Our charts guide has the rest.

Two Things Nobody Mentions

Alt text has to be in the same human language as the page, and the requirement comes from the conformance rules rather than from the alt text criterion itself. An English alt attribute on a French page is a conformance problem rather than a style slip, and it is a real and common failure on multilingual sites, because alt fields are the last thing a translation workflow picks up.

And alt text goes stale. Not updating the text alternative when the image changes is a named failure, and it is the one that eats any library of pre-written descriptions. An editor swaps the photograph, the alt field stays exactly as it was, and now the page confidently describes something that is not there.

What About AI-Generated Alt Text?

A model looks at a picture and tells you what is in it. Whether that is the right sentence depends on why the picture is on the page, and the answer to that lives in the words around it rather than in the image. So a tool handed nothing but the file is guessing at the half that matters, and one handed the surrounding page does better. Neither of them knows that this photograph is the one your legal team insisted on, or that the chart beside it already gives the number. The same photograph on a travel site and a university site wants different words, and the picture never says which site it is sitting on.

In practice it produces a blue kettle on a white background where you needed a cordless kettle in matte blue, and it will happily describe the photo on your About page that should have had an empty alt. Treat it as a first draft, edit every one, and keep the stale-alt failure above in mind, because a generated library is exactly the kind of thing nobody revisits.

How to Accept Thousands of Generated Descriptions

Run a generator across your whole catalogue and you have swapped one problem for another, because nobody can read ten thousand of anything. The job stops being writing and becomes accepting, and accepting needs a sheet rather than a feeling about how it went. Seven fields, one row per image, and the row travels with the image rather than with the batch.

FieldWhat you recordWhat a failing row looks like
Image and pageThe file, and the page it appears on, because one file on two pages can need two different answersOne description reused everywhere the file appears, on pages where the image is doing different jobs
PurposeInformative, functional or decorative, decided by reading the page rather than the pictureA decorative flourish given a description, or a linked logo described instead of named for its destination
The output as it arrivedThe generated text, unedited, kept so you can tell later what the tool produced and what a person changedNothing kept, so six months on nobody can say whether the model or the editor wrote the sentence
Verdict in contextAccept, edit or replace, reached with the surrounding page in front of youA verdict reached by reading the alt attribute on its own in a spreadsheet
Variant checkWhether images in the same set are told apart from each otherNine product shots all reading "a pair of shoes on a white background"
Duplicate and stale checkWhether the text repeats the words already beside it, and whether the image has been swapped sinceAlt text saying exactly what the caption underneath it says, so the page says it twice
Correction and retestThe replacement wording, who wrote it, and the date it reached the live siteA correction agreed in the sheet and never shipped, which is the commonest ending
An acceptance sheet for a generated alt text library

How Many of Them You Actually Have to Read

Fewer than all of them, and there is no published number that tells you how many is enough, so anybody quoting you a percentage invented it. What you can do is choose the sample on purpose and write down what you chose. Read every image inside a set whose members have to be told apart, so product galleries and staff photographs. Read every functional image, meaning anything that is a link or a button, because those fail hardest and fail silently. Then take a spread of the ordinary ones across templates rather than across pages, since the same slot repeats underneath.

And then read a genuinely random handful on top, which is the step everybody skips. If the random handful turns up a kind of failure your chosen sample missed, the chosen sample was not representative, and you have found that out yourself rather than from a customer. That is the same two-sample logic W3C's evaluation methodology asks for on a website, and it works here for the same reason.

One boundary worth drawing, because we sell something that sits next door to this. The sheet above is a method your team runs over a library you generated, and it samples. Our alt text and image audit is a different shape. It does not sample. It reads your content images page by page and reports what each one says to somebody who cannot see it, and your team still writes the replacement words. So one is a method you run and the other is a review you buy, and the coverage is what separates them. Neither turns a sampled pass into a statement about a whole catalogue, and no sampled result should be written into a supplier questionnaire as though it were one.

One honest limit

No tool verifies that alt text is true. Our alt text checker catches classic signals such as filenames, image of prefixes, and descriptions that have run away with themselves, and those are heuristics rather than the rule. The published position is stronger than our own claim. The automated rules written for this criterion are all still at proposed status, every one of them tests whether a name exists rather than whether it is right, and W3C states plainly that such rules are informative and are not required for determining conformance. Our method explains what a person does instead.

Common questions

How do I write good alt text?
Start with why the image is on the page rather than what is in it. Describe the purpose, keep it to a sentence, skip image of, and never use the filename. If it needs more than a sentence, write a short alt and put the detail in the page as text or a table.
Should decorative images have alt text?
No. Give them an empty alt attribute so assistive technology skips them, and know that W3C prefers a different route entirely, which is delivering a purely decorative image as a CSS background so it never enters the markup. Putting words on a decorative image is its own named failure, distinct from leaving the attribute off.
How long should alt text be?
There is no threshold in the standard. A sentence is right for most images. Needing much more is the signal that the image is complex and wants a short alt plus a full description in the page, rather than a longer attribute.
What alt text should a logo have?
If it links somewhere, describe the destination, so WCAGrules home rather than logo. If it sits inside a link whose text already says Home, give the image an empty alt, because otherwise the destination gets announced twice. If it is not a link at all, the company name is enough.
Does putting the words in the alt attribute fix an image of text?
It fixes one rule and not the other. Alt text satisfies the non-text content rule. The images-of-text rule is separate, at Level AA, and it wants real text that somebody can resize, restyle and reflow. So the remedy there is real text styled with CSS, or a control letting the user swap the image for text.
Is AI-generated alt text good enough?
As a first draft. A model describes what is in an image, and what decides the words is why the image is on the page, which lives in the page rather than in the picture. Edit every one, and remember that a generated library goes stale the first time an editor swaps an image without touching the alt field, which is a named failure of its own. If the library runs to thousands, the acceptance sheet in this guide is the way through it.

Sources

Keep reading

More on building it right

Reading about it is the cheap part.

Find out where your site actually stands. The free scan checks 10 pages in a real browser against all 90 supported automated rules, keeps its 27 best-practice checks separate from WCAG findings, and names the rule behind every finding. The full audit adds an expert review and a real blind screen-reader user. From $499, with the report in 5 business days on Rapid and 10 on Standard, and the clock starting at cleared payment.

Go somewhere useful

Find tools, resources and your workspace.

29 destinations