**`<caption>`** is the table's equivalent of a figure caption or heading — it must appear as the FIRST child directly inside `<table>` (before `<thead>`/`<tr>`) and browsers render it centered above the table by default. Screen readers announce the caption when a user navigates into the table, giving immediate context for what the data represents — much more reliably than a nearby `<h2>` or `<p>` that isn't structurally tied to the table itself.
1Understanding <caption>
`<caption>` is the table's equivalent of a figure caption or heading — it must appear as the FIRST child directly inside <table> (before <thead>/<tr>) and browsers render it centered above the table by default. Screen readers announce the caption when a user navigates into the table, giving immediate context for what the data represents — much more reliably than a nearby <h2> or <p> that isn't structurally tied to the table itself.
A <caption> is more accessible than putting a heading right before the <table> in the markup, because it's programmatically tied to the table itself — a screen reader announces it specifically as that table's caption, regardless of where the user enters the table.
<table>
<caption>Top 3 Programming Languages, 2026</caption>
<tr><th>Rank</th><th>Language</th></tr>
<tr><td>1</td><td>JavaScript</td></tr>
</table>2Practical Example
Here is a real-world application of <caption> showing how it is used in production HTML.
<!-- Styling the caption's position with CSS -->
<style>
caption { caption-side: bottom; font-style: italic; }
</style>
<table>
<caption>Source: internal sales data</caption>
<tr><td>...</td></tr>
</table>3Best Practices
Follow these guidelines when working with <caption>:
1. Add a <caption> to any table where the data's purpose isn't already obvious from surrounding context
2. Place it as the very first child of <table> — it's invalid anywhere else
3. Keep it a concise title, not a lengthy explanation (put longer notes in a <p> instead)
Tip: A <caption> is more accessible than putting a heading right before the <table> in the markup, because it's programmatically tied to the table itself — a screen reader announces it specifically as that table's caption, regardless of where the user enters the table.
<table>
<caption>Top 3 Programming Languages, 2026</caption>
<tr><th>Rank</th><th>Language</th></tr>
<tr><td>1</td><td>JavaScript</td></tr>
</table>