Skip to main contentOpen accessibility widget

Alt text: how to write it, with examples

What alt text is, how to write it, when to leave it empty, and examples.

Author avatar

Alen Velkov

Author

Write alt text that works: a picture frame with an orange tag labelled alt

Alt text is the short description that stands in for an image when someone can't see it. Here's how to write it, when to leave it empty, and examples you can reuse.

Quick answer

Alt text (alternate text) is a text alternative that replaces an image for people who can't see it. Screen readers read it aloud, and search engines can read it too. Good alt text describes what the image means on your page, usually in a short phrase or sentence. Purely decorative images get an empty alt attribute (alt="") so screen readers skip them. Alt text is covered by WCAG success criterion 1.1.1, at Level A, the lowest conformance level.

What is alt text?

Alt text is a short written description that replaces an image when the image can't be seen. It's also called alternate text or alternative text, after the HTML alt attribute that holds it.

The HTML standard gives a simple test: replacing every image with its alt text should not change the meaning of the page. In code, it looks like this:

<img src="jumper.jpg" alt="Red wool jumper with a cable-knit pattern">

You rarely need code. If your website editor has an alt text or image description field, the text goes there.

Why does alt text matter?

Alt text makes the information in your images available to people who can't see them. Screen readers read it aloud or show it in braille. It also helps mobile users who switch images off to save data.

It's a baseline requirement. WCAG success criterion 1.1.1 requires a text alternative for all non-text content, with a few exceptions such as pure decoration. Our complete guide to WCAG explains the levels and principles.

The European Accessibility Act requires websites to be "perceivable", and text alternatives are the first WCAG guideline under that principle. Penalties are set nationally: see EAA fines by country.

There's a search angle too. The W3C notes that text alternatives make images indexable by search engines. That gives search engines text to understand your images, but it doesn't guarantee rankings. Our article on accessibility and SEO covers where the two overlap.

How to write good alt text

Write what the image means in its context, as you'd describe it to someone over the phone. That phone test comes from the HTML standard. Six rules cover most images:

  1. Describe the purpose, not every pixel. A stock photo of a happy family can simply say "We're family-friendly", if that's the impression it's there to give.
  2. Let context decide the detail. The W3C's example: a bird's exact species may not matter on a parks website, but it does on a bird website.
  3. Keep it short. A short phrase or sentence is enough for most images. Neither WCAG nor the HTML standard sets a character limit.
  4. Skip "image of" and captions. The HTML standard says to describe the content without mentioning that there is an image. Don't repeat a caption or nearby text either.
  5. Copy the words in images of text. If a banner says "20% off all coats", the alt text says the same.
  6. For links and buttons, describe the action. A printer icon gets "Print this page", not "Printer". A magnifying glass on a search button gets "Search".

Never use a file name or a placeholder like "image". The W3C lists both as failures of WCAG 1.1.1.

When should alt text be empty?

Alt text should be empty (alt="") when an image is purely decorative or repeats text already on the page. An empty alt tells screen readers to skip the image.

Typical examples: borders, spacers, mood photos and icons next to link text that says the same. Whether an image is decorative is a judgement only the author can make, based on why it's on the page.

Don't leave the alt attribute out altogether. The W3C notes that some screen readers then announce the file name instead.

Not sure? The W3C's alt decision tree comes down to four questions:

  1. Does the image contain text? Put the same words in the alt text, unless they're already on the page.
  2. Is it a link or a button? Describe where it goes or what it does.
  3. Does it add meaning? Write a short description. For charts, also give the full information on the page.
  4. Is it purely decorative? Use alt="".

Alt text decision flow: text in image, link or button, adds meaning, or decorative, and what to write for each

Alt text examples

The same rules give very different alt text depending on the image's job. Common cases on business websites:

Good vs bad alt text: file name vs product description, Logo vs company home, empty alt for a decorative divider

ImageBad alt textGood alt text
Product photo of a red wool jumper on a shop pagejumper-final-2.jpgRed wool jumper with a cable-knit pattern, front view
Magnifying glass icon on a search buttonMagnifying glassSearch
Company logo that links to the homepageLogo[Company name] home
Homepage banner reading "20% off all coats until Sunday"Sale banner20% off all coats until Sunday
Bar chart of sign-ups by quarter in a reportChartBar chart of sign-ups by quarter, figures in the table below
Decorative wave line between page sectionsBlue wave divider(empty: alt="")

Can an alt text generator write it for you?

Automated alt text suggestions can describe what's in a picture, but they can't know why it's on your page. The W3C says the author determines the text alternative, based on usage, context and content.

Treat a suggestion as a first draft at most. Check it matches the image's purpose, cut detail nobody needs, and ask whether the image is decorative instead.

Automated checks have the same limit: the HTML standard notes they can't tell phony alt text from correct alt text. Run a page through our free accessibility checker, then review the wording yourself.

What this means for your business

  1. Start with your key pages. Product pages, the homepage and campaign landing pages come first.
  2. Make alt text part of publishing. Whoever uploads an image writes its alt text, or marks it as decorative.
  3. Brief your agencies. Ask for alt text with every image, banner and chart they deliver.
  4. Keep important text out of images. Real text can be resized and restyled without losing clarity.
  5. Check regularly. Accessibility monitoring catches new problems as your site changes.

Frequently asked questions

What does alt text mean?

Alt text means alternative text: the description in an image's HTML alt attribute that screen readers read instead of the image.

How long should alt text be?

There's no fixed limit in WCAG or the HTML standard. A short phrase or sentence works for most images. Charts and diagrams need a longer description on the page itself.

Can I use an alt text generator?

As a starting point only. A person still has to check the text fits the image's purpose on that page.

How do I add alt text to social media posts?

If the platform offers an alt text or image description option, use it. The same rules apply: describe the point of the image and include any text shown in it.

Does alt text help SEO?

It gives search engines text to understand your images. It's not a ranking guarantee.


Sources: WCAG 2.2, success criterion 1.1.1 Non-text Content (W3C); W3C WAI Images Tutorial and alt decision tree; HTML Living Standard, section 4.8.4.4 (WHATWG).

Share this post

You might also like

Two more articles worth reading while this topic is still fresh.

Be quotable in AI answers: a speech bubble with a quote mark and numbered citation badges

Generative engine optimization explained

GEO explained: how AI answers pick what to quote, and where accessibility fits.

Sweden - EAA fines

Sweden EAA Fines: Up to SEK 10 Million, Plus Vite

Sweden's EAA fine: SEK 10,000 to 10 million, plus vite. Straight from the law.