# Accessible Tables: Headers, Captions and Scope

Source: https://allyway.ai/glossary/accessible-tables

Accessible tables are data tables marked up so that their structure is available to software: real table elements, header cells (th) linked to their data cells with scope or headers and id, and a caption. This is how they meet WCAG 1.3.1 Info and Relationships at Level A.

Accessible tables let screen reader users understand data the way sighted users do: by knowing which row and column a value belongs to. When a price list is built from styled `div` elements or the headers are just bold cells, a screen reader reads "49, 99, 149" with no idea which plan or which month each number means. With real header cells, it says "Pro, yearly, 99".

## What it means

Tables fall under [WCAG 1.3.1 Info and Relationships](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html) (Level A, [WCAG 2.2](https://allyway.ai/regulations/wcag-2-2)): information, structure and relationships conveyed through presentation must be programmatically determined or available in text. A grid of rows and columns is exactly such a relationship – see [info and relationships](https://allyway.ai/glossary/info-and-relationships) for the full criterion.

W3C lists these techniques for data tables:

| Technique | What it does | When to use it |
|---|---|---|
| H51 | Table markup (`table`, `tr`, `th`, `td`) for tabular information | Every data table |
| H63 | `scope` on header cells (`col`, `row`, `colgroup`, `rowgroup`) | Simple tables with one header row and/or column |
| H43 | `id` on headers, `headers` on data cells | Complex tables with several header levels |
| H39 | `caption` names the table | Any table that needs a title |

And the failures to avoid: F91 (table headers not correctly marked up), F90 (headers and data cells associated wrongly through `headers` and `id`) and F46 (using `th`, `caption` or a non-empty `summary` in layout tables).

> **Tip:** > **Keep tables simple**
> Two small tables are easier to navigate than one with merged cells and three header levels. A simple table with `scope` is enough in most cases.

## Examples

```html title="Example"
<table>
  <caption>Plans and prices per month</caption>
  <thead>
    <tr>
      <th scope="col">Plan</th>
      <th scope="col">Monthly</th>
      <th scope="col">Yearly</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">Starter</th>
      <td>€19</td>
      <td>€190</td>
    </tr>
    <tr>
      <th scope="row">Pro</th>
      <td>€49</td>
      <td>€490</td>
    </tr>
  </tbody>
</table>
```

The `caption` names the table, column headers carry `scope="col"`, and the first cell of each row is a row header with `scope="row"`. A [screen reader](https://allyway.ai/glossary/screen-reader) moving to "€490" announces "Pro, Yearly". On narrow screens, let the table scroll horizontally inside its container instead of breaking it apart – that keeps the structure and helps with [reflow](https://allyway.ai/glossary/reflow).

**Do:** Do

Use `table` only for data, mark headers with `th` and `scope`, add a `caption`, keep one value per cell, and use `headers` and `id` when headers span several levels.

**Don't:** Don't

Build data grids from `div` elements, fake headers with bold `td` cells, leave header cells empty, merge cells for decoration, or use tables for page layout with `th` and `caption` inside.

## How to check accessible tables



## Questions

Q: What makes a table accessible?
A: Real table markup, header cells (`th`) linked to their data cells with `scope` or with `headers` and `id`, and a `caption` that names the table. Then screen readers can tell users which row and column each value belongs to.

Q: When should I use scope and when headers?
A: `scope` is enough for simple tables with one header row and/or one header column. Use `headers` and `id` for complex tables where a data cell belongs to more than one level of headers.

Q: Do tables need a caption?
A: A `caption` is the W3C technique (H39) for naming a data table, and it helps screen reader users decide whether to read the table. A visible heading right before the table also gives context, but only the caption is tied to it in the code.

Q: Can I use tables for layout?
A: Use CSS for layout. If a layout table is unavoidable, it must not contain `th`, `caption` or a non-empty `summary` – W3C lists that as failure F46 – and it should carry `role="presentation"`.

Q: Is WCAG 1.3.1 required by the European Accessibility Act?
A: Yes, indirectly. The [European Accessibility Act](https://allyway.ai/regulations/eaa) points to [EN 301 549](https://allyway.ai/glossary/en-301-549), which takes over WCAG Level AA for the web. 1.3.1 is Level A and therefore included.
