What is alt text? Meaning, purpose and examples

Alt text is a short written description of an image, read aloud by screen readers and shown when images fail. Here is how to write it, with real examples.

By
Picture Optimizer team
Published
Type
Guide

Alt text (alternative text) is a short written description of an image, stored in the image's alt attribute. Screen readers read it aloud to people who can't see the image, browsers show it when the image fails to load, and search engines use it to understand what the image shows. Good alt text says what the image means on that page in a short phrase or sentence.

Key takeaways

  • Alt text replaces the image for people who can't see it, so write what they would miss.
  • Context decides the text: the same photo can need different alt text on different pages.
  • Decorative images get an empty alt attribute (alt=""), not a missing one.
  • Linked images describe where the link goes, not what the picture looks like.
  • Skip "image of" and "picture of"; screen readers already announce it as an image.

What alt text looks like in HTML

```html
<img src="plumber-repairing-sink-drain-pipes.avif"
alt="Plumber repairing drain pipes under a kitchen sink">
```

In WordPress you don't need to write HTML: the Attachment Details panel in the Media Library has an "Alt Text" field, and WordPress's own documentation describes it as used for accessibility.

What alt text is for

Accessibility. WCAG 2.2 Success Criterion 1.1.1, Non-text Content, is a level A requirement: all non-text content presented to the user needs a text alternative that serves the equivalent purpose. The exception is pure decoration, which should be implemented so assistive technology can ignore it.

Broken or blocked images. If an image doesn't load, the browser shows the alt text in its place.

Search. Google's image SEO documentation says Google uses alt text along with computer vision and the contents of the page to understand the subject of an image, and calls alt text the most important attribute for image metadata. Its guidance favors specific descriptions over vague ones and warns against stuffing keywords into alt attributes.

How to write alt text: the five cases

The W3C's alt decision tree sorts images into five cases. Work out which one you have first.

1. Informative images

Images that add information, such as a photo of your team, your shop or a finished job. Describe what matters in a short phrase or sentence. W3C's guidance is to convey the meaning, which "typically isn't a literal description of the image."

  • Weak: alt="photo"
  • Better: alt="Electrician repairing an outdoor electrical panel"

2. Decorative images

Background textures, dividers, or a stock photo that repeats what the text already says. Use an empty alt attribute: alt="". Leaving the attribute out entirely is not the same: W3C notes that some screen readers then announce the image's file name instead.

3. Functional images

An image that is a link or a button. Describe the action or destination, not the picture.

  • A logo linking to your home page: alt="Smith Plumbing home"
  • A magnifying glass icon on a search button: alt="Search"

4. Images of text

If an image contains words that aren't elsewhere on the page, the alt text should include those words. For a logo, that is usually the business name.

5. Complex images

Charts, diagrams and maps carry more than a sentence can hold. Give a short alt text that identifies the image and put the full information in the page text, a table or a linked description.

Examples from real photos

These alt texts were written by AI vision for photos in our sample run of 54 business images (free-license Unsplash photos), shown unedited:

Photo

AI-written alt text

Plumber

Plumber repairing white PVC sink drainage pipes under a kitchen sink with blue lighting

Dental clinic

Modern dental examination room with turquoise chair, white cabinetry, and advanced medical equipment

Bakery

Assorted artisanal breads, croissants, and bagels displayed on wooden shelves inside a bakery glass case.

Optometrist

Snellen eye chart with black letters on a white background used for vision testing.

Furniture showroom

Large grey leather sectional sofa with matching ottoman and accent pillows in a modern showroom setting

Across all 54 photos, the AI alt texts ran from 68 to 116 characters, with a median of about 92, and none started with "image of" or "picture of."

These are good first drafts, and they also show why a human review matters. On a plumber's own site, "blue lighting" adds little, while the service and place might add a lot: "Our plumber replacing a leaking sink drain in a Denver kitchen" (if that is true). On the dental clinic's site, "advanced medical equipment" is vague; naming what a patient would care about is better. The AI describes what it sees; you know why the image is on the page.

Common mistakes

  • Keyword lists. "plumber, plumbing, emergency plumber, best plumber" is not a description and Google explicitly advises against it.
  • Repeating the caption. If a visible caption already says it, the alt text can be shorter or complementary. W3C notes a short text alternative is enough when nearby text explains the image.
  • Describing a link's picture instead of its purpose.
  • Missing alt on decorative images, instead of alt="".
  • File names as alt text, such as "IMG_4382".

Writing alt text for a whole library

Writing alt text by hand is fine for a few images and slow for hundreds. Our AI alt text generator writes a first draft for each photo, along with a title and caption, and you check and edit every field before anything is saved. It is part of Starter and up (2 credits per photo with AI text, 1 for compression only); the Free plan does not include AI. For the difference between the three fields, see the image caption generator.

Keep reading

Sources

Questions

Short answers to what people ask about this.

Alternative text. It is the text in an image's alt attribute that stands in for the image when someone can't see it, for example when using a screen reader or when the image fails to load.