WebTech1223411 logo WebTech1223411Web tech, read closely
Accessibility

How to Build Accessible Data Tables for Screen Readers

A sighted user glances at a pricing table and instantly knows that "$29" belongs to the Pro plan and the "Monthly" row.

A developer's monitor showing a pricing table in a browser beside a code editor, headphones resting on the desk for screen reader testing

A sighted user glances at a pricing table and instantly knows that "$29" belongs to the Pro plan and the "Monthly" row. A screen reader user hears "$29" and nothing else, unless the markup tells their software which headers that cell belongs to. Building accessible data tables is mostly about giving assistive tech that missing context, and the good news is that plain HTML already does 90 percent of the work if you let it.

This guide covers the semantic structure screen readers rely on, how to handle complex headers, captions and summaries, responsive patterns that do not break accessibility, and a quick manual test you can run in five minutes.

How screen readers read a table

When NVDA, JAWS or VoiceOver reaches a real HTML table, they announce it as a table along with its size, for example "table with 5 rows and 4 columns". The user can then move cell by cell with keyboard commands. In NVDA and JAWS that is Ctrl plus Alt plus the arrow keys; in VoiceOver on macOS it is the VoiceOver modifier plus the arrow keys.

Each time the user changes column, the reader announces the new column header. Each time they change row, it announces the row header. That is the whole trick. If your headers are marked up correctly, a user can jump to any cell and hear exactly what it means. If they are not, every cell is an orphaned value.

This only works on real table elements, or on elements with the matching ARIA table roles. A grid of div elements styled with CSS Grid looks identical on screen and reads as a flat pile of text.

The markup accessible data tables need

Here is the minimum structure, described element by element:

  1. A table element as the container. Not a div with display set to table.
  2. A caption element as the first child, naming the table, such as "Plan prices, billed monthly or yearly". Screen readers announce it when the user enters the table, and it doubles as a visible title.
  3. A thead element holding the row of column headers.
  4. th elements for every header cell, both across the top and down the first column if the first column labels the rows.
  5. A scope attribute on each th: scope="col" for column headers and scope="row" for row headers.
  6. A tbody element holding the data rows, with td elements for data.

Modern screen readers often guess headers correctly in simple tables even without scope, but guessing fails as soon as a table has a row header column. Adding scope costs nothing and removes the guesswork.

Example structure

Imagine a three plan pricing table:

Plan prices by billing period
BillingStarterProTeam
Monthly$9$29$79
Yearly$90$290$790

When a screen reader user lands on "$290", they hear "Yearly, Pro, $290". Without the row headers and scope, they might hear only "$290".

Handling complex tables with merged headers

Tables with headers that span several columns, or two levels of headers, are where most accessibility problems hide. You have two tools.

  • scope="colgroup" and scope="rowgroup" work for a header that spans a group of columns or rows, such as a "2025" header sitting over four quarter columns. Pair them with colgroup elements so the span is defined.
  • id and headers attributes handle anything irregular. Give each th an id, then list the relevant ids in the headers attribute of each td. It is verbose, but it is explicit and every major screen reader supports it.

My honest advice is to avoid both where you can. If a table needs the headers attribute on every cell, it is usually two or three tables pretending to be one. Splitting it often helps sighted users just as much.

Why you should not add ARIA to a normal table

A common suggestion in accessibility checklists is to add role="table", role="row" and role="columnheader" to make tables "more accessible". On a real HTML table, that does nothing useful. The browser already exposes those roles. At best you are adding noise; at worst a typo like role="grid" changes how screen readers behave entirely.

The grid role in particular tells assistive tech that the table is an interactive widget, like a spreadsheet, and it expects you to manage keyboard focus cell by cell with JavaScript. Use it on a static data table and screen reader users may find their usual table commands stop working the way they expect.

The rule is simple. Use native table elements for tabular data and add no table roles. Reach for ARIA table roles only when you truly cannot use a table element, for example a virtualised list rendered with div elements, and then add every role at every level consistently.

Making tables responsive without breaking them

Wide tables on a phone are a real problem, and some fixes create new ones. Here is how the common patterns compare:

Responsive table patterns compared
PatternScreen reader impactVerdict
Horizontal scroll wrapperTable semantics kept intactBest default
Stacked cards with display blockSome browsers drop table semantics when display changesRestore roles with ARIA if you use it
Hiding columns on small screensData is gone for everyone on mobileAvoid for important data
Rebuilding as a div gridSemantics lost entirelyAvoid

For the scroll wrapper, put the table inside a div with overflow set to auto. If the wrapper can scroll, give it tabindex="0" so keyboard users can scroll it with arrow keys, plus role="region" and an aria-labelledby pointing at the caption so the focus stop has a name. Without the name, users hear an unlabelled focus stop, which is confusing. Our article on the keyboard navigation accessibility test explains why every focus stop needs a clear purpose.

Also watch layout decisions upstream. Choosing CSS Grid vs Flexbox for page layout is fine, but neither should replace a table element for data that has rows and columns.

A five minute manual test

Automated tools check that th elements exist, but they cannot tell whether a header makes sense when read aloud. That is one reason automated accessibility scanners miss most real problems. Run this instead:

  1. Turn on NVDA on Windows or VoiceOver on Mac.
  2. Tab or arrow into the table and confirm the caption and size are announced.
  3. Jump to a cell in the middle and move one cell right, then one cell down.
  4. Confirm you hear both the column header and the row header for each move.
  5. Zoom the page to 400 percent and confirm you can still reach every column.

If any cell sounds like a bare number, fix the headers before shipping.

Frequently asked questions

Do accessible data tables need a caption?

A caption is strongly recommended because it names the table when a screen reader user enters it. If you already have a visible heading right above the table, you can link it with aria-labelledby instead. What matters is that the table has an accessible name.

Is it okay to use tables for page layout?

No. Layout tables make screen readers announce rows and columns that carry no meaning, which slows users down. Use CSS Grid or Flexbox for layout, and keep table elements for real tabular data.

What does the scope attribute do in an HTML table?

The scope attribute tells assistive technology whether a header cell labels a column, a row or a group of either. Screen readers use it to announce the right headers as users move between cells. It is a small attribute with a large effect on comprehension.

LV
Lorenzo Vidal

Lorenzo started as a visual designer and moved into CSS after watching too many of his layouts fall apart on phones. He writes about front-end craft, interfaces and accessibility, and still tests everything with the keyboard first.

More posts by Lorenzo

More in Accessibility

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp foxstudiosscratch gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto