<figure> & <figcaption> Tags in HTML

Quick facts

CategoryFlow content, palpable content (<figure>)
Content modelFlow content, with at most one <figcaption> as the first or last child
Tag omissionNeither the start nor the end tag can be omitted, for either element
Permitted parents<figure>: any element that accepts flow content. <figcaption>: a <figure> only
DOM interfaceHTMLElement (both)

Syntax

<figure> <img src="chart.png" alt="Sales rose 40% in 2026"> <figcaption>Figure 1: Monthly sales</figcaption> </figure>

Live example

Edit the code below and watch the preview update instantly.

index.html
Preview

Attributes

AttributeDescription
—Both elements accept only the global attributes.

Common examples

An image with a caption and credit

The caption explains the image; a credit line can go in the same figcaption.

<figure> <img src="lighthouse.jpg" alt="A white lighthouse on rocks at sunset" width="800" height="533"> <figcaption>The old lighthouse at dusk. <small>Photo: Jane Doe</small></figcaption> </figure>

A captioned code listing

Figures aren’t just for images — numbered code samples in tutorials are a classic use.

<figure> <figcaption>Listing 1: A minimal HTML page</figcaption> <pre><code>&lt;!DOCTYPE html&gt; &lt;title&gt;Hi&lt;/title&gt;</code></pre> </figure>

Several images, one caption

A figure can group a small gallery under a single caption.

<figure class="pair"> <img src="before.jpg" alt="The garden before the makeover"> <img src="after.jpg" alt="The garden after the makeover"> <figcaption>Before and after.</figcaption> </figure> <style> .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; } .pair figcaption { grid-column: 1 / -1; } </style>

A chart with a summary

For charts and diagrams, use the caption to state the key takeaway, and keep the alt text for describing the image itself.

<figure> <img src="sales.png" alt="Bar chart of monthly sales from January to June"> <figcaption>Sales doubled between January and June.</figcaption> </figure>

<figure> vs <picture>

They solve different problems and often work together. <picture> is about which image file the browser should load — different crops for phones, or WebP and AVIF versions with a JPEG fallback. <figure> is about meaning: it groups a self-contained piece of content with its caption.

To show a responsive image with a caption, put the <picture> inside the <figure> and add a <figcaption> after it.

<figure><picture>
PurposeGroup content with a captionChoose the best image file
Can holdImages, code, quotes, chartsSources plus one <img>
CaptionYes (<figcaption>)No

Common mistakes to avoid

  • Wrapping every image in a figure. Decorative images and small inline icons don’t need one; use figure for content that the text refers to.
  • A caption that repeats the alt text. Alt describes the image for people who can’t see it; the caption adds context for everyone. Say different things.
  • Putting figcaption in the middle. It must be the first or last child of the figure.
  • Two captions in one figure. Only one figcaption is allowed; combine the text or split into two figures.

Accessibility & SEO tips

  • Captions are among the most-read text on a page, so use them to state the point of the image or chart.
  • Search engines use captions as context for images, which can help them appear in Google Images for relevant searches.
  • Keep alt text on every meaningful image even when it has a caption.

Browser support

Supported in all modern browsers, including Chrome, Edge, Firefox, Safari and their mobile versions. It was introduced with HTML5, and only very old browsers such as Internet Explorer 8 needed workarounds.

Related tags

Frequently asked questions

Is <figure> only for images?
No. A figure can hold any self-contained content the text refers to: an image, video, chart, table, code listing, poem or quotation.
Do I still need alt text if an image has a <figcaption>?
Yes. The alt attribute describes the image for people who cannot see it, while the caption adds context for everyone. They do different jobs, so they shouldn't repeat each other word for word.
Is <figcaption> required inside <figure>?
No, it is optional. If you add one, there can only be one, and it must be the first or the last child of the <figure>.
How do I center an image and its caption?
Give the figure a width and center it, for example figure { width: fit-content; margin: 1rem auto; text-align: center; }. The image and caption then sit together in the middle.
How do I put the caption above the image?
Place the <figcaption> as the first child of the <figure>, before the image. It can only be first or last, never in the middle.
Does <figcaption> help SEO?
It can. Search engines read captions as context for the image and the page, so a descriptive caption helps them understand what the image shows.