designwithfocus

Accessibility

Alt Text vs Image Caption: Two Different Strings

By Design With Focus Team 5 min read
An image with a short alt string and a visible caption below

Short answer

Alt text and a visible caption are not the same string. Alt text is the image's text alternative for people who cannot process the image. A caption, often a figcaption, is text everyone sees on the page. Screen readers can meet both, so do not copy one into the other.

Last verified against the sources listed below.

Key takeaways

  • WAI says every informative image needs a text alternative that carries the information or the function.
  • The HTML spec says alt is replacement text, not advisory text like the title attribute.
  • A figure may include one figcaption, and that element is the caption of the figure.
  • MDN says figcaption also gives the figure an accessible name, so a caption is not hidden.
  • WebAIM says a figure still needs alt text, and the caption should not repeat it.

Alt text vs image caption is a comparison of two strings that do different jobs. WAI’s images tutorial says images need text alternatives that describe the information or function they represent. That alternative is what people who do not see the image get instead.

A caption is the visible line, usually under the picture, that everyone who can see the page can read. The HTML spec says a figure is self-contained flow content, optionally with a caption, and that the first figcaption child is that caption. They are not substitutes.

Web accessibility covers both strings. Writing one does not finish the other.

What is the alt string?

Alt text is the img element’s text alternative. MDN says the alt attribute holds a textual replacement for the image. Screen readers read it. Browsers also show it if the image fails to load.

The HTML spec’s img section says the alt value is equivalent content for people who cannot process images or who have image loading disabled. It also says alt does not represent advisory information, and that user agents must not present it the way they present the title attribute.

WAI splits images by purpose. An informative image needs a short description of the essential information. A decorative image gets an empty alt="".

A functional image, such as a link or a button, should describe the function rather than the drawing. An image of text should repeat the words in the image. A complex graph needs a full text equivalent of the data.

What is the caption?

A caption is visible text attached to a figure. MDN’s figcaption page says the element represents a caption or legend for the rest of its parent figure, and that it provides the figure with an accessible name.

The spec allows the figcaption to be the figure’s first child or its last child, not a sibling pasted somewhere else on the page. If the figure has no figcaption, it has no caption. The figure’s contents stay part of the surrounding flow. The spec says to use aside for content that is only tangential, not figure.

Because the caption is on screen, it is for sighted readers and for anyone reading the text. MDN’s note that figcaption names the figure means a screen reader can meet that string too. Treat it as public text. Do not hide a necessary fact in alt and leave the caption empty if the fact belongs on the page.

How do the two strings differ?

They answer different questions. Alt replaces the image. The caption captions the figure. The table stays with those roles.

Question Alt text Caption
Typical markup alt on the img figcaption inside figure
Who sees it as page text Not shown as body copy. Shown if the image fails Shown to everyone looking at the page
Job in the spec Textual equivalent or replacement for the image Caption or legend for the figure’s contents
Empty on purpose alt="" for a decorative image Omit figcaption when the figure has no caption
A mistake the docs flag Using title instead of alt Repeating the alt string so it is announced twice

WebAIM says alternative text is announced in place of images, shown when an image fails, and used by search engines. It also says a figure still needs alt text, and that the caption should not convey the same information, to prevent redundancy. Image SEO is a separate pass over file size and delivery. It does not choose these two strings for you.

Which string do you write?

Write alt for every img. Add a caption only when the page should show a line of text with the figure.

  1. Decide the image’s job. WAI’s list is informative, decorative, functional, text in an image, or complex. The alt value follows that job.
  2. For a photo that carries information, write a short alternative that states the information, not the file name. MDN says not to use the words “image of” when a screen reader already announces a graphic.
  3. For decoration, set alt="". Do not omit the attribute. WebAIM says every image should have an alt attribute, including the empty one.
  4. For a link or button that is only an image, put the action in alt. An empty value leaves that control without a name.
  5. If the layout needs a visible line, wrap the image in figure and add one figcaption as the first or last child. Write the line you want on screen. Do not paste the alt string into it unchanged.

A caption such as “Figure 2. Intake in March” can sit under a chart whose alt says “Bar chart of monthly intake, highest in March.” The caption is the label. The alt is the data in words. They support each other because they are not the same sentence.

What does contrast have to do with it?

Nothing about the wording. A contrast checker compares two colors. It does not read an alt attribute or a figcaption. Use it when the caption’s text color fails against the background, which is a separate accessibility check from whether the alternative exists.

WAI also notes that images help many people, including people with cognitive disabilities, and that a text-only page that simply deletes the images is a worse fix. Keep the image, write the alternative, and add a caption when the visible page needs one. The two strings stay different even when both are present.

Frequently asked questions

Can a caption replace the alt attribute?

No. MDN says title is not a substitute for alt, and that a caption belongs in figure and figcaption. WebAIM says the figure still needs alt text, and the caption should not repeat it. The HTML spec says alt is the fallback for people who cannot process the image. The caption is separate text shown on the page.

When should alt be an empty string?

Use an empty alt when the image is only decoration, or when nearby text already states the content. WAI says decorative images get an empty alt. The HTML spec says that image is not a key part of the content. Keep the attribute. If the image is the only content of a link, an empty alt leaves the link without a name.

Does a screen reader see the caption?

Yes. The caption is ordinary page text, so a screen reader can read it. MDN says figcaption provides the figure with an accessible name. Copying the alt string into the caption can announce the same words twice. WAI says a text alternative can be read aloud or as Braille. Write alt for someone who does not get the pixels. Write the caption as the line you want on screen.

What should a functional image's alt say?

Describe the action, not the drawing. WAI says a link or button image should name the function, such as print. MDN says to describe the action, such as next page, rather than an arrow shape. WebAIM says a home logo can use the company name. An empty alt on that linked logo leaves the link unnamed.

Where does the figcaption have to sit?

Inside the figure, as the first or last child. MDN says the parent must be a figure, and the figcaption must be that figure's first or last child. The HTML spec allows one figcaption followed by the other content, or the content followed by one figcaption. The first figcaption child is the caption. If there is no figcaption, the figure has no caption.

Sources