HTML <figcaption> Tag

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

Definition and Usage

The <figcaption> element is a caption or legend for its parent <figure>. It describes the rest of the figure’s contents and can give the figure an accessible name.

It must be the first or last child of that <figure>. For images, keep <img alt="…"> for the image’s own text alternative — do not replace alt with a caption alone.

Baseline · Widely available.

Not deprecated and not experimental. Stable across modern browsers since about July 2015.

Placement rule.

Only inside <figure>, and only as that figure’s first or last child — never between other figure children.

HTML Syntax

syntax.html
<figcaption> caption text</figcaption>

Both start and end tags are required. Content is flow content (text, links, emphasis, and so on).

Attributes

<figcaption> has no element-specific attributes. Use globals when needed:

AttributeDescriptionTry it
classStyle hook for caption appearanceTry it
idUnique target if you need to link to the captionOptional
langLanguage of the caption when it differs from the figureTry it

Global Attributes

The <figcaption> tag also supports the Global Attributes in HTML.

Live Preview

Change the caption text and its position (first or last child) on a real figure.

<figcaption> must be the first or last child of <figure>.

Figure
JavaScript logo
JavaScript logo

Caption after the image (last child).

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Caption After the Image

Most common pattern: media first, then <figcaption> as the last child.

HTML
<figure>
  <img src="/images/javascript.png" alt="JavaScript logo" width="128" height="128">
  <figcaption>JavaScript logo</figcaption>
</figure>
Try It Yourself

How It Works

  1. Open <figure> as the self-contained unit.
  2. Add the image (or other content) inside the figure.
  3. Place <figcaption> last with a clear caption.
  4. Close </figure> so the caption belongs to that figure only.

Example 2 — Caption Before the Image

Valid alternative: <figcaption> as the first child.

HTML
<figure>
  <figcaption>Nature pattern sample</figcaption>
  <img src="/images/nature-pattern.jpg" alt="Abstract nature pattern" width="200" height="140">
</figure>
Try It Yourself

How It Works

  1. Put <figcaption> first inside the figure.
  2. Follow with the media (or other figure content).
  3. Do not insert siblings before the caption if it is meant to be first.
  4. Either first or last is valid — pick one consistent pattern for your site.

Example 3 — Caption Plus alt

Use both: alt for the image alternative, figcaption for the visible figure caption.

HTML
<figure>
  <img
    src="/images/circle_image.jpg"
    alt="Orange circle on a light background"
    width="160"
    height="160"
  >
  <figcaption>Figure 1. Demo circle used in layout tests.</figcaption>
</figure>
Try It Yourself

How It Works

  1. Write alt that describes the image if it were missing.
  2. Write figcaption as the human-facing caption (context, figure number, credit).
  3. Avoid copying the same sentence into both unless it truly serves both roles.
  4. Keep alt="" only when the image is decorative and the caption already covers meaning.

Example 4 — Caption a Code Sample

<figure> is not only for images — caption diagrams, quotes, or code too.

HTML
<figure>
  <pre><code>console.log("Hello");</code></pre>
  <figcaption>Example 1. A one-line JavaScript log.</figcaption>
</figure>
Try It Yourself

How It Works

  1. Wrap the sample in <figure>.
  2. Put the code (or other content) as a figure child.
  3. Add <figcaption> as first or last child to name the sample.
  4. Use a specific caption (“Example 1…”) so readers can refer to it later.

Edge Cases & Pitfalls

Most figcaption bugs are wrong parent, wrong position, or confusing it with alt.

parent

Only inside figure

Do not put <figcaption> under <body> or <div> alone. Parent must be <figure>.

order

First or last child only

Never sandwich the caption between other figure children. Move it to the start or the end.

alt

Caption ≠ alt

alt is for the image alternative. figcaption captions the figure. Missing alt on meaningful images is still an accessibility problem.

count

One caption per figure

Use a single <figcaption>. Extra captions are invalid structure.

tables

Tables use caption

For data tables, use <caption> inside <table>, not figcaption.

Browser Support

The <figcaption> element is core HTML in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<figcaption>

Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera all support figure captions fully.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer 9+
Supported
<figcaption> Widely supported

Bottom line: Safe to use everywhere inside a figure. Keep it first or last, and pair images with proper alt text.

Key Takeaways

  • Role: <figcaption> captions its parent <figure>.
  • Position: must be the first or last child of that figure.
  • With images: keep meaningful alt; caption is not a full substitute.
  • Scope: works for images, code, quotes, and other self-contained figures.

One line: put one clear <figcaption> as the first or last child of <figure>.

Default CSS Settings

Typical user-agent styling is minimal:

default.css
figcaption {
  display: block;
}

Spacing, alignment, and italic captions come from your CSS. Style the parent figure when you want a shared frame around media and caption.

Frequently Asked Questions

The figcaption element is a caption or legend for its parent figure. It describes the rest of the figure’s contents and can provide the figure with an accessible name.
Only as a child of figure, and it must be either the first or the last child of that figure.
No. alt describes the image when it cannot be seen. figcaption captions the whole figure for everyone who can see the page. Use both when an image needs both jobs.
No. It only supports global attributes such as class, id, and lang.
No. A figure should have at most one figcaption, as the first or last child.
Yes. A figure can hold images, code, quotes, diagrams, and more. figcaption describes whatever that figure contains.

Next: figure

Learn the self-contained unit that holds media and its caption.

figure tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful