RunTheTests
/

CSV to HTML Table

Convert a CSV into accessible, escaped HTML table markup.

What you paste

Parsed in your browser — never uploaded

How this reads your output

The header row becomes th elements carrying a scope attribute, and the remaining rows become td cells inside a tbody. Every value is escaped, so angle brackets and ampersands in the data cannot break the markup or inject anything. The output is indented and free of styling, which is what makes it usable in any template rather than tied to one design.

What the results mean

th with scope
What lets a screen reader announce which column a value belongs to. Without it a data table is read as a flat run of numbers.
Cells needing escaping
Values containing characters with meaning in HTML. Escaping them is what stops data from becoming markup.
thead and tbody
Structural grouping. It lets a long table repeat its header when printed, and gives styling a clean hook.

Common problems and fixes

The table looks unstyled
That is deliberate. Browsers apply almost no default styling to tables, so borders, padding and alternating rows all come from your own stylesheet. Adding inline styles here would fight whatever design system the markup lands in.
Numbers are hard to compare down a column
Right-align numeric columns and use tabular figures, which most typefaces provide through a font-variant-numeric setting. It matters more than it sounds: proportional digits make columns of numbers genuinely harder to scan.

Frequently asked questions

Should I use a table for layout?

No. Tables are for data with a row and column relationship, and using one for page layout confuses assistive technology, which announces structure that is not really there. Grid and flexbox handle layout, and they reflow on small screens where a table cannot.

How do I make a wide table work on a phone?

Wrap it in a container with horizontal scrolling and give that container a tabindex so keyboard users can reach the scroll. Rebuilding the table as stacked cards below a breakpoint also works, at the cost of losing the ability to compare down a column.

Does a caption matter?

Yes, more than most people expect. A caption element gives the table a name that screen readers announce before reading any data, which is the difference between arriving in a table that has a purpose and arriving in an unlabelled grid of numbers.

Put this on your own site

Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.

Embed code
<iframe src="https://runthetests.com/embed/csv-to-html-table/" width="100%" height="720" style="border:1px solid #e5e5e5;border-radius:8px" title="CSV to HTML Table" loading="lazy"></iframe>

Preview it at https://runthetests.com/embed/csv-to-html-table/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.

More in Data