CSV → HTML Table

Convert CSV into a clean <table> with thead/tbody.

Open tool

Overview

The CSV-to-HTML table converter emits a clean <table> element with <thead> and <tbody> sections from a pasted CSV. Output is plain semantic HTML — no inline styles, no framework classes — so it drops cleanly into any stylesheet you already have.

It's handy when you need to embed a small dataset in a static page, a CMS, or an HTML email without going via JavaScript. Bloggers, marketers building newsletter content, and developers building lightweight reports use a csv to html converter to skip writing string-concatenation table builders.

How it works

CSV is parsed per RFC 4180. The first row becomes the <thead> row of <th> cells; remaining rows fill <tbody> with <td> cells. Every cell value is HTML-escaped — &, <, >, and " become entities — so untrusted CSV content can't sneak HTML or script into your page.

The output is indented for readability and uses semantic markup only. Optional toggles add a scope="col" attribute on header cells (good for screen readers) and a <caption> if you supply one.

Examples

Input:
name,city
Alice,Berlin
Bob,Lisbon

Output:
<table>
  <thead>
    <tr><th scope="col">name</th><th scope="col">city</th></tr>
  </thead>
  <tbody>
    <tr><td>Alice</td><td>Berlin</td></tr>
    <tr><td>Bob</td><td>Lisbon</td></tr>
  </tbody>
</table>
Input:
title,description
"Foo & Bar","<b>important</b>"

Output (escaped):
<td>Foo &amp; Bar</td><td>&lt;b&gt;important&lt;/b&gt;</td>

FAQ

Are the cells escaped against XSS?

Yes. Every value is HTML-escaped before insertion, so a CSV containing <script> tags or other HTML markup is rendered as visible text rather than executed.

Can I get an HTML email-friendly version with inline styles?

Inline styles aren't generated by default. Pipe the output through an HTML inliner like Juice if you need email-safe markup with embedded CSS.

What about column alignment?

Alignment isn't set inline — that's a styling decision. Add text-align: right in CSS for numeric columns, or use the CSV-to-Markdown tool which infers alignment automatically.

Try CSV → HTML Table

An unhandled error has occurred. Reload ×