skip to content

When should an image be wrapped in a figure element with a figcaption, and how should the alt text relate to the caption?

level: middleimportance: should knowfreq 50%

answer

  1. self-contained, referred to as a unit
  2. caption is for everyone
  3. different audiences, so no verbatim repeat
  4. first or last child, nothing between
  5. not every image wants one

basics

~20 s

Use figure with figcaption when content is referenced as a self-contained unit that carries a visible caption. The caption is visible to everyone; alt serves only readers who cannot see the image, so the two must not repeat each other word for word.

solid answer

~50 s

`<figure>` marks a self-contained piece of content that the surrounding text refers to as a unit — an image, a code listing, a diagram, a pull quote, a table — and `<figcaption>` gives it a visible caption. The `figcaption` must be the first or last child of the `figure`, and it supplies the figure's accessible name, which is why the pairing is worth using rather than a `div` with a styled paragraph. The key judgement is that the caption and the `alt` have different audiences: the caption is read by everyone, while `alt` exists for people who cannot see the image. Copying the caption into `alt` means a screen reader user hears the same sentence twice in a row. Write `alt` to convey what the picture shows that the caption does not; when the caption genuinely conveys everything and the image adds nothing beyond it, `alt=""` is a defensible choice. And a caption is not mandatory — plenty of images need `alt` and no `figure` at all.

go deeper

for a junior

Know the shape: a figure wraps self-contained content and figcaption is its caption, placed as the first or last child. Be able to say that the caption is visible to everyone while alt is for people who cannot see the image.

for a middle

Explain the content-model rule and the consequence of duplication — a screen reader user hears both the caption and the alt, so copying one into the other means the same sentence twice. Show you can split identification (caption) from description (alt).

for a senior

Demonstrate judgement on the hard case: when the caption fully conveys the content, argue for alt="" and explain why it is safe there but not for a bare image. Also call out figure overuse, which turns a document into a wall of meaningless figure units.

for a principal

Own it at the content-model level: decide when your CMS or design system should offer a caption field at all, who writes it versus who writes alt, and how the two fields are explained to authors so they stop being filled with the same sentence.

## What `<figure>` is for `<figure>` represents **self-contained content** that the document refers to as a single unit and that could, in principle, be moved elsewhere — to the end of a section, into an appendix — without breaking the flow of the prose. "See figure 3" is the giveaway. `<figcaption>` is its optional caption. Two details of the content model matter: - `figcaption` must be the **first or last child** of the `figure`. Not floating in a wrapper `div`, not in the middle. - A `figure` is not image-only. Code listings, tables, diagrams, blockquotes, audio and video all belong there when they are referenced as a unit. ```html <figure> <img src="deploy-pipeline.png" alt="Build, test and deploy stages run in sequence; deploy is gated on tests passing"> <figcaption>Figure 3. The release pipeline after the 2026 rework.</figcaption> </figure> ``` ## What the pairing buys you The caption is associated with the content **structurally**, not just visually. A paragraph styled to look like a caption sits next to the image and nothing links them; a `figcaption` inside the `figure` is part of the same unit. In the accessibility tree the `figure` exposes a figure role, and the `figcaption` provides its accessible name — so a user navigating by structure hears the caption together with what it captions rather than encountering a stray sentence. That also means a `figure` with a `figcaption` and no other identification is still identifiable, which is one reason the pairing shows up in interview questions about captions and alt at the same time. ## Caption and alt are for different people This is the part candidates get wrong. Both are text attached to the same image, but: - The **caption** is visible page content. Everyone reads it — sighted users included. - The **alt** is the substitute for the image. Only readers who do not perceive the image consume it. So a screen reader user encounters *both*. Duplicate them and the experience is: "Figure 3, the release pipeline after the 2026 rework… image, Figure 3, the release pipeline after the 2026 rework." Two announcements of one sentence, and still no idea what the diagram actually depicts. The rule that follows: **the caption names or contextualises; the alt describes what is in the image.** In the snippet above the caption identifies the diagram and dates it, while the alt says what the diagram shows — three sequential stages with a gate. Neither is redundant. ## When `alt=""` inside a figure is right Sometimes the caption really does convey everything the image carries: a photograph whose entire informational content is "the team at the 2025 offsite", captioned exactly that. Repeating it in `alt` adds nothing. Writing `alt=""` is defensible there, because the figure still has its caption as visible, announced content, so no information is lost — unlike a bare decorative image, where the empty alt means genuinely nothing is conveyed. Treat this as a judgement call to justify, not a default. If you can describe something a sighted reader gets from the picture that the caption omits, that description belongs in `alt`. ## When not to use `<figure>` - The image is decorative. A decorative image with a caption is a contradiction — captions announce that content matters. - The image is inline, part of the sentence's flow, and not referred to as a unit. An avatar next to a comment, an icon in a button, a logo in a header: these are just `<img>` with appropriate `alt`. - You only want a styled caption look. `figure` is semantic, not a layout hook; styling is a separate concern. ## The defects that ship The recurring ones are `alt` copied verbatim from the caption; a caption written as a `<p>` outside the `figure` so nothing associates it; `figcaption` nested inside another element instead of being a direct first or last child; and `figure` used as a general-purpose wrapper for any image on the page, which floods a document with figure landmarks that mean nothing.

  • Does a figure element have to contain an image?
    No. `figure` marks any self-contained content the surrounding prose refers to as a unit — a code listing, a data table, a diagram, a blockquote, an audio or video clip. The defining property is self-containment and reference, not the media type. That is also why the caption is a `figcaption` element rather than an image-specific attribute.
  • A team writes the caption as a paragraph immediately after the image instead of using figcaption. What is lost?
    The association. Visually the two still look related, but nothing in the markup connects them, so the caption is just a stray paragraph to anyone navigating structurally, and the figure gets no accessible name from it. Moving the caption inside the `figure` as its first or last child restores the relationship with no visual change required.

saying these in an interview costs you the question

  • Copies the caption verbatim into alt
  • Wraps every image on the page in a figure
  • Says figure is only for images
  • Puts figcaption in a wrapper div inside the figure
  • Treats figure as a styling hook for captions

context