Skip to main content
Category: Document Accessibility

Table Headers

Also known as: Header Cells, Table Header Cells
Simply put

Table headers are the labels that identify what the rows or columns of a data table represent, such as a column titled "Date" or a row labeled "Total." They help users understand how the information in a table is organized and which data belongs to which category. This is especially important for people using assistive technology like screen readers, which rely on properly marked headers to explain the relationships between cells.

Formal definition

Table headers are cells that describe the meaning of associated data cells in an HTML data table, typically marked up using the <th> element rather than <td>. The <th> element defines a cell as the header of a group of table cells and, per HTML semantics, can be associated with data cells so assistive technologies can convey the correct relationships. For simple tables, the scope attribute (for example scope="col" or scope="row") indicates whether a header applies to a column or a row. More complex structures may require additional techniques: tables with header cells spanning multiple columns or rows (irregular headers) can use attributes such as colspan, rowspan, and the headers/id association mechanism, and multi-level headers use subheadings to describe successive sections of a table. Marking headers programmatically, rather than relying on visual styling alone, is generally necessary for the structure to be exposed to users of assistive technology.

Why it matters

Table headers establish the relationships that make tabular data understandable. When a screen reader encounters a data cell in a properly marked-up table, it can announce the associated header, telling the user, for example, that a given value belongs to the "Total" row and the "March" column. Without programmatically defined headers, a table often reduces to a stream of disconnected values, and the meaning that sighted users infer from visual alignment and styling is lost to people using assistive technology.

This matters most for complex data. Tables with headers that span multiple columns or rows, or that use subheadings to describe successive sections, can be especially difficult to interpret when the structure is not conveyed programmatically. As recognized authorities such as the W3C note, subheadings that describe what the next section of a table is about can be unclear when they are not marked as headers. Relying on visual styling alone, bold text, background color, or position, does not expose these relationships to screen readers.

Proper table markup contributes to WCAG-aligned outcomes related to information, structure, and relationships being programmatically determinable, though this guidance is not legal advice. Meeting a specific technique does not by itself guarantee an accessible experience or legal compliance, and manual and assistive technology testing are generally needed to confirm that a table's relationships are conveyed as intended.

Who it's relevant to

Front-End Developers
Developers are responsible for choosing the correct markup, using <th> for header cells, applying scope for simple tables, and using colspan, rowspan, and the headers/id mechanism for irregular or multi-level tables. They implement the programmatic structure that assistive technologies rely on.
Content Authors and Editors
People who create tables in content management systems or documents need to designate header rows and columns rather than relying on bold text or visual alignment. When authoring tools support marking header cells, using that option helps ensure the relationships are conveyed to screen reader users.
Accessibility Testers and QA Engineers
Testers verify that table headers are correctly associated with data cells, particularly for complex tables. Because automated tools detect only a portion of issues, manual review with screen readers is generally needed to confirm that header relationships are announced accurately.
UX and Content Designers
Designers who structure data presentations can reduce complexity by favoring simple, regular table layouts where possible, which makes correct header markup easier to implement and interpret. Where multi-level or spanning headers are unavoidable, early planning helps ensure the structure can be conveyed programmatically.

Inside Table Headers

Table header cell (th element)
In HTML, the th element identifies a cell as a header rather than a data cell. Marking headers with th rather than styling a td to look like a header is what allows assistive technologies to programmatically associate data with the correct headers.
scope attribute
Applied to a th element, the scope attribute declares whether a header applies to a row, a column, a row group, or a column group (using values such as row, col, rowgroup, and colgroup). It is commonly used to clarify header relationships in tables with a straightforward structure.
headers and id association
For more complex tables, each th can be given an id and each associated data cell can reference one or more of those ids in a headers attribute. This explicit association is generally recommended when a simple scope value cannot unambiguously convey the relationship.
Programmatic relationship
The underlying purpose of table headers is to make the relationship between headers and data programmatically determinable, so that screen readers can announce the relevant header when a user navigates to a data cell. This supports WCAG's Info and Relationships success criterion (1.3.1, Level A, present since WCAG 2.0).
Caption and summary context
While distinct from header cells, the caption element and descriptive text can provide overall context for a table. These help orient users but do not replace properly marked-up header cells for conveying cell-level relationships.

Common questions

Answers to the questions practitioners most commonly ask about Table Headers.

Does adding bold or larger text to a table's top row make it a proper header?
No. Visual styling such as bold or larger text conveys headers only to sighted users viewing the rendered page. It does not programmatically identify cells as headers, so assistive technologies like screen readers cannot announce the header associations. To create genuine table headers, you need to use the correct markup (for example, the appropriate header elements and scope or association attributes) rather than relying on visual formatting alone.
If a data table looks organized and readable on screen, does that mean it is accessible?
Not necessarily. A table that appears well-organized visually may still lack the programmatic header relationships that assistive technology depends on to convey context. Visual clarity and programmatic accessibility are separate concerns. Meeting a visual expectation does not guarantee that a screen reader user can understand which header applies to a given cell, and manual testing with assistive technology is generally needed to confirm the table works as intended.
How do I mark up header cells in a simple data table?
For a straightforward data table, designate header cells using the table header element rather than the standard data cell element, and use the scope attribute to indicate whether each header applies to a column or a row. This lets assistive technologies associate each data cell with its corresponding header. Confirm the intended behavior through manual testing with a screen reader, since correct markup should be verified in practice.
What should I do when a table has headers spanning multiple rows or columns?
For more complex tables with headers that span multiple rows or columns, the scope attribute alone may not be sufficient to express the relationships clearly. In these cases you can associate data cells with their headers explicitly using unique identifiers on the header cells and referencing those identifiers from the data cells. Because complex tables are harder for assistive technology to interpret, it is often advisable to simplify the structure where possible or split it into multiple simpler tables.
How can I test whether my table headers are correctly associated?
Automated tools can detect some issues, such as missing header markup, but they detect only a portion of potential problems and cannot fully judge whether header associations make sense to a user. Manual testing with assistive technology, such as navigating the table with a screen reader to confirm that the correct headers are announced for each cell, is generally required to verify that headers are meaningful and correctly associated.
Should layout tables also use header markup?
Tables used purely for visual layout rather than presenting data generally should not include header markup, because doing so can convey misleading structural information to assistive technology. Header cells are intended for genuine data tables where relationships between headers and data need to be communicated. For visual layout, other techniques such as CSS-based approaches are commonly preferred so that no false data relationships are announced.

Common misconceptions

Any cell that is visually bold or centered at the top of a column functions as a table header.
Visual styling alone does not create a programmatic header relationship. Assistive technologies rely on the th element (and, where needed, scope or headers/id associations); a styled td is generally announced as ordinary data.
Adding table headers guarantees the table is accessible and legally compliant.
Correct headers address one aspect of table accessibility and support specific WCAG success criteria, but they do not by themselves ensure an accessible experience or legal immunity. Automated tools detect only a portion of issues, and manual testing with assistive technology is generally required.
The scope attribute is sufficient for every table.
The scope attribute is commonly adequate for simple tables, but complex tables with merged cells or multiple levels of headers may require explicit headers and id associations to convey relationships unambiguously.

Best practices

Use the th element to mark genuine header cells rather than relying on visual styling of td cells.
Apply the scope attribute (row, col, rowgroup, or colgroup) to header cells in simple tables to clarify whether each header applies to a row or column.
For complex tables with multiple or nested headers, use id attributes on header cells and headers attributes on data cells to establish explicit associations.
Provide a caption element to give the table an accessible name and overall context where appropriate.
Avoid using tables purely for visual layout; reserve data tables and their header markup for tabular data, so that programmatic relationships remain meaningful.
Validate header associations with manual review and assistive technology testing, since automated checks alone may not confirm that headers are announced correctly to screen reader users.