What's alt text? Examples, the decision tree and how to write it

20 min read

  • Alt text
  • WCAG

Alt text is the words that stand in for an image. A screen reader reads them out to people who can’t see the image. A browser shows them when the image doesn’t load. In web code it sits in the image’s alt attribute.

Good alt text says what the image means on that page, not what it looks like. Run each image through W3C’s five questions. Then write the alt, or leave it empty if the image is only decoration.

In short

  • Every image needs an alt attribute. Leaving it out fails WCAG. A decorative image gets an empty one, alt="".
  • Say the job, not the picture. A search button’s alt is “search”, not “magnifying lens”.
  • No source sets a length limit. Keep it short and on point. Put the detail for a chart in the page text.
  • A checker can’t judge it. Tools find missing alt. Only a person can tell if the words are right.

Alt text is short for alternative text. It’s a text alternative to an image. It replaces the image for anyone who can’t see it.

The HTML spec puts the rule this way: if you swapped every image on a page for its alt text, the meaning of the page shouldn’t change.

The HTML spec also says the alt text “is a replacement for the image, not a description of the image”. That’s the idea behind most of this page.

Here’s the spec’s own example.

A text adventure says “You are standing in an open field west of a house.” Then comes an image of a house. Then “There is a small mailbox here.”

Good alt text for the house is “The house is white, with a boarded front door.” It reads on from the sentence before it.

The spec marks “A white house, with a boarded front door.” as bad. It describes the picture, so the story no longer flows when the image isn’t there.

Can people see alt text?

Not usually.

W3C’s Easy Checks says you don’t usually see alt text on a web page, because it’s in the page’s code. It shows up when a browser is set not to display images, and the alt text appears in their place.

A screen reader reads it out when it reaches the image.

Is alt text the same as an alt tag?

Yes, people mean the same thing.

But Easy Checks says “alt tag” is technically wrong.

alt is an attribute of the image element, not a tag.

Say “alt attribute” or “alt text”.

How an issue shows up in our reports

Criterion
1.4.3 Contrast (Minimum)
Where
Body text
Status
To fix

Download a sample report →

Alt text is for anyone who can’t see or use an image.

That includes people who are blind and use screen readers.

Assistive technology can read the text aloud, show it on screen or turn it into braille.

Alt text also helps people who turn images off to speed up a page or save data.

It helps people on a very slow connection, people on a text-only browser and people using a hands-free voice browser in a car, too.

And it helps people who find it hard to understand what an image means.

Search engines use alt text too.

Design102, a creative design studio for government, says so on its GOV.UK blog.

Section508.gov says alt text makes images available for search engine optimisation. W3C says text alternatives help people search for non-text content.

W3C says text alternatives help people search for non-text content.

None of these sources says alt text lifts your place in search results.

WCAG 2.2 covers alt text in 1.1.1 Non-text Content. It says all non-text content shown to the user has a text alternative that serves the same purpose. It’s Level A, the lowest of WCAG’s three levels.

So any site that aims for Level AA has to meet it too.

Non-text content means images, charts, audio, animation and anything else that isn’t text.

The rule lists exceptions, and each one still asks for something.

What WCAG says about alt text
Kind of content What 1.1.1 asks for
A control or an input, such as an image button A name that says what it’s for (WCAG 4.1.2 Name, Role, Value adds more)
Video or audio At least a short label that says what it is (Guideline 1.2 adds more)
A test that wouldn’t work as text At least a short label that says what it is
A sensory experience, such as a work of art At least a short label that says what it is
A CAPTCHA Text that says what it’s for, and another form of it for a different sense
Decoration, layout or something users don’t see Built so assistive technology can ignore it

Is alt text legally required?

Alt text is part of WCAG 1.1.1, so a rule that asks for WCAG Level AA asks for alt text.

GOV.UK says government services must meet WCAG 2.2 level AA.

In the US, Section508.gov says alt text is a requirement in the Section 508 guidelines for digital content.

Whether a law covers your own site is a separate question.

For the UK, see UK accessibility law.

For the US, see ADA website compliance.

W3C’s alt decision tree is five questions.

You ask them in order, and the first “yes” tells you what to write.

W3C says the tree doesn’t cover every case.

  1. Does the image contain text?
  • If the same text is also on the page as real text, use an empty alt.
  • If the text is only there for visual effect, use an empty alt.
  • If the text does a job, such as an icon, say what the image does.
  • If the text isn’t anywhere else, put the text in the alt.
  1. Is the image in a link or a button? Would it be hard to tell what the link or button does without the image? If so, say where the link goes or what the button does.
  2. Does the image add meaning to the page?
  • If it’s a simple picture or photo, write a short description that gives that meaning.
  • If it’s a graph or other complex image, put its information somewhere else on the page.
  • If it shows the same thing as real text nearby, use an empty alt.
  1. Is the image only decoration, or not meant for users? Use an empty alt.
  2. Still not sure? W3C sends you to its images tutorial, where the examples below come from.

Read the second branch of question 1, about text used only for visual effect, with care.

WCAG says text is only decoration if you could swap or reorder the words and they’d still do the same job. Jumbled letters in a background pattern are one case. Mix them up and the pattern still works.

If the words matter, they go in the alt.

W3C’s images tutorial sorts images into kinds.

Five of its kinds are below, plus groups of images from the HTML spec.

The examples come from W3C, the HTML spec and Section508.gov.

Each alt is quoted as the source gives it, and each image is described as the source describes it.

Informative images

An informative image gives a simple idea or fact.

W3C says you can say it in a short phrase or sentence.

The alt gives the meaning of the image, which usually isn’t a literal description of it.

  • Two icons, a telephone and a fax machine, each next to a phone number. Their alt text is “Telephone” and “Fax”.
  • A picture of a dog with a bell on its collar, next to text about guide dogs. The alt is “Dog with a bell attached to its collar.”
  • A diagram of how to unscrew a bottle cap. The alt is “Push the cap down and turn it counter-clockwise (from right to left)”.

The same image can need different alt text on different pages.

WCAG gives an image of the world used as a link.

On a travel site its alt is “International Travel”.

On a university site it’s “International Campuses”.

Section508.gov shows the same idea in its example for photos and portraits. Its helpful alt is “Dr. Martin Luther King Jr.” Its unhelpful one is “Black and white photo of Dr. Martin Luther King Jr. wearing a suit and tie.”

The first one gives what the image tells you.

The second one tells you how it looks.

Decorative images

A decorative image adds no information.

The same point may already be in the text, or the image only makes the page look better.

W3C says give it an empty alt, alt="", so screen readers can skip it.

  • An image used as a border in the page design: alt="".
  • A drawing of a crocus bulb inside a link that already says “Crocus bulbs”: alt="".
  • A picture of a sleeping dog next to text that explains the saying “Let sleeping dogs lie”: alt="".

Only you can decide if an image is decorative, because it depends on why it’s there.

W3C’s image of the Tropical House greenhouse is decorative.

But W3C says it should be treated as informative if it were there to identify a plant.

Where you can, W3C says to add decorative images with CSS instead.

Functional images

A functional image does something. It’s a link, a button or another control. Its alt says what happens when you use it, not what the image shows.

W3C gives these pairs.

  • “print this page” rather than “(image of a) printer”
  • “search” rather than “magnifying lens”
  • “Example.com homepage” rather than “Example.com logo”

W3C’s own logo, used alone as a link to its home page, has the alt “W3C home”.

A printer icon that opens the print dialogue box has “Print this page”.

An icon that says a link opens in a new window has “new window”.

If the link already has text, the image may need no alt of its own.

W3C’s logo sits beside the link text “W3C Home” inside the same link, so its alt is empty.

Section508.gov gives arrow buttons too.

“Next arrow button” and “Previous arrow button” are helpful.

“Right arrow” and “Left arrow” aren’t.

Images of text

An image of text shows words that people are meant to read.

W3C says to use real text styled with CSS where you can, because real text can be resized without blurring.

When you do use an image of text, the alt holds the same words.

  • A slogan in styled text with a shadow. The alt is “Your access to the city”, and the effects aren’t described.
  • From the HTML spec, the words “Earth Day” decorated with flowers and plants, used as a heading. The alt is “Earth Day”.

Logos are images of text too.

The HTML spec says a logo that stands for a company or group has alt that names it.

The alt must not contain a word like “logo”. Its example logo, used as a page heading, has the alt “The XYZ company”.

If the logo sits right next to the company’s name, its alt is empty.

W3C’s Web Accessibility Initiative logo has the alt “Web Accessibility Initiative”, because there’s no need to say it’s a logo.

Section508.gov’s own logo example does use the word “logo”. Here the HTML spec’s “must not” is the stricter rule, so this page follows it.

Complex images

A complex image holds more than a short phrase can say.

W3C names graphs and charts, diagrams and maps. It asks for two parts.

A short alt says what the image is.

A long description, on the page or linked from it, gives the information.

W3C’s bar chart of website visitors has the short alt “Bar chart showing monthly and total visitors for the first quarter 2025 for sites 1 to 3”.

The long description then gives the values and trends for each site.

The alt can also tell people where the long description is.

W3C’s version uses the alt to say where on the page the long description is.

What doesn’t work is a label on its own.

The HTML spec says “sales graph” would be poor alt text for a graph in a financial report.

“Event sales graph” is no more help for a bar chart of event sales.

For a flow chart, Section508.gov says the alt describes the order of the steps.

For an organisation chart, it says a bulleted list may work better for screen reader users.

A group of images

Sometimes several images make one picture.

The HTML spec says one image gets the alt for the whole picture, and the rest get an empty alt. Its star rating shows three filled stars and two empty ones.

The first image has the alt “3 out of 5”, and the rest have alt="".

Write what you’d say if you couldn’t use the image.

The HTML spec suggests reading the page to someone over the phone, without saying there’s an image.

What you say in its place is usually a good start. Then check it against these points from the sources.

  • Give the meaning on this page, not a list of what’s in the picture.
  • Don’t start with “image of” or “photo of”. Screen readers already say it’s an image.
  • Don’t repeat what the text next to the image already says.
  • Put in any words that appear in the image.
  • Write it in the same language as the page.
  • Change the alt when the image changes. WCAG counts alt text left out of date as a failure.

The HTML spec shows why “photo of” matters.

A screen reader might read “A photo of Isaac Asimov” as “(Image) A photo of Isaac Asimov”.

The spec’s alt for his photo is “Isaac Asimov had dark hair, a tall forehead, and wore glasses. Later in life, he wore long white sideburns.”

Easy Checks says good alt text “is not an exact science”.

Some people want more detail, and others want much less.

How long should alt text be?

No primary source sets a character limit for alt text.

Section508.gov says it should be “short and to the point”.

W3C says an informative image needs a short phrase or sentence.

A complex image also needs a long description.

And the HTML spec gives long alt text where the image is the main point of the page.

Alt that’s too short and alt that’s too long are both common mistakes.

Design102 asks you to imagine describing a picture in a 280-character Tweet.

That’s a way to think about it, not a limit.

Does alt text need full stops?

No primary source sets a punctuation rule.

The examples on this page show both: W3C’s “Telephone” has no full stop, and its “Dog with a bell attached to its collar.” has one.

Design102 notes that screen readers pause where you tell them to. A comma or a full stop in the alt gives a short pause.

But depending on the user’s settings, they might not read out exclamation or question marks.

Is alt text the same as a caption?

No. A caption adds to the image, and alt text replaces it.

The HTML spec says alt text should never contain text that could be the image’s caption.

The spec’s own example is an inkblot card from the Rorschach test.

The caption is “A black outline of the first of the ten cards in the Rorschach inkblot test.”

Using that same line as the alt is wrong.

The spec says it gives people without images the same text twice and doesn’t help them.

Design102 says a captioned image “may not need additional alt text”.

On a web page the HTML spec is stricter.

An image in a figure with a caption needs real alt text.

Only an image that just repeats the text around it gets an empty alt.

W3C’s notes on 1.1.1 list common mistakes that count as failures. These are the ones that come up with alt text.

  • A file name or placeholder text as the alt (WCAG failure F30).
  • No alt attribute at all on an image, an image map area or an image button (F65).
  • A decorative image not marked so assistive technology can skip it (F38).
  • Words such as “spacer” or “image” as the alt for an image that should be skipped (F39).
  • A chart that shows information by colour, with alt that leaves the colour information out (F13).
  • Alt text not updated when the image changes (F20).

Section508.gov adds its own list. It includes alt that describes how the image looks but not why it’s there, alt that repeats the main text, and a computer-made description that misses the point of the image.

W3C’s decorative images tutorial says why a missing alt matters.

Some screen readers read out the file name instead.

On a web page, alt text goes in the alt attribute of the img element.

The HTML spec says it must be there and must not be empty, unless the spec says otherwise.

W3C’s search button shows it on an image button:

HTML
<input type="image" src="searchbutton.png" alt="Search">

A decorative image keeps the attribute with nothing in it.

W3C’s border image is the example:

HTML
<img src="topinfo_bg.png" alt="">

The HTML spec allows a missing alt only in rare cases, such as a photo site where nobody knows what an uploaded image shows. It says these cases should be kept “to an absolute minimum”.

Two more rules from the sources:

  • Leave out the title attribute on images you want skipped. WCAG’s technique for these images is an empty alt with no title. The HTML spec says many browsers show a title only on mouse hover, so keyboard and touch users miss it.
  • Use alt in HTML emails. The HTML spec allows a missing alt only in a private email to someone known to see images. It doesn’t apply to emails sent to public mailing lists, so an email to a mailing list needs alt text.

In Word, Excel, PowerPoint and Outlook, alt text goes in the Alt Text pane.

Microsoft’s guide gives the steps.

  1. Right-click the image, chart or other object.
  2. Select View Alt Text. The Alt Text pane opens on the right.
  3. Type the alt text, or edit the text that’s already there.

If the image is decorative, such as a border, select Mark as decorative in the same pane.

Microsoft says that when you save a document as a PDF, images marked decorative are tagged so screen readers skip them.

Section508.gov says screen readers skip everything in a Word document’s headers and footers.

So if a header holds a logo or text people need, move it into the main page and give it alt text.

Automatic alt text in Microsoft 365

Microsoft 365 can write alt text for you.

To turn it on or off, go to File, Options, Accessibility. Then select or clear “Enable the option to generate alt text using AI” under Alt Text.

Microsoft’s own steps ask you to review and edit what it writes.

Remove any note it adds, such as “Description generated with high confidence.”

When the text is right, select the Approve alt text checkbox.

Section508.gov says to avoid default or AI-generated alt text, because it usually doesn’t say what the image is for. Its example is a screenshot of a form, which an AI might describe as “Screenshot of a phone screen”.

If the image is there to show how to use the form, the alt has to describe what the screenshot shows.

The HTML spec says tools that write web pages should get alt text from their users wherever they can. It calls phony alt text “the even more egregious error”, worse than leaving alt out. The spec also says automated checkers can’t tell phony alt text from correct alt text.

If a tool writes your alt text, read it and fix it before it goes live.

For what overlays can and can’t fix, see accessibility overlays.

Every image needs an alt attribute, and the words need to be right.

Easy Checks says automated tests can tell you if alt is missing.

To judge if it’s right, you need to see the image in context.

You can find more on testing in general in how to test website accessibility.

  1. Run the page through WAVE, an accessibility checker. W3C’s Easy Checks says this check works in any browser. WAVE marks missing alt with “ERROR: Missing alt text”.
  2. Or use the Web Developer extension. In the Images tab, select “Replace images with alt attributes”. The DWP Accessibility Manual says this swaps each image for its alt text.
  3. Read each alt text next to its image. Ask if someone who can’t see the image would get what it’s there for.
  4. If you’re checking a Word, Excel or PowerPoint file, open Review, then Check Accessibility. Microsoft’s Accessibility Checker flags missing alt text, and file names or URLs used as alt.

Microsoft says its checker doesn’t flag a slicer with no alt text. A slicer is a set of filter buttons in Excel.

Ben Walsh’s accessibility checklist for designers puts it plainly: “A checklist can tell you an image has alt text, but it can’t tell you the alt text is right.”

To hear how a screen reader reads images out, see screen reader testing.

Alt text is one check among many.

The accessibility audit checklist covers images alongside the rest.

Accessibility Testing runs accessibility audits that end in a written audit report against WCAG 2.2 AA.


I've designed products for more than ten years, leading accessibility and design system work for product teams. I also built Perception, a Figma plugin that checks contrast while you design.

Sources

Every rule and example on this page comes from the group that wrote it: W3C for WCAG and its tutorials, WHATWG for HTML, and US and UK government pages for their own advice.

Figures

  • W3C’s five questions as a flow. Drawn from W3C’s alt decision tree.
  • A bar chart with its short alt and long description. From W3C’s Complex Images tutorial, Example 1.

Talk to us about an audit

Book a 25-minute call and tell us what you need checked.

Book a 25-minute call