Xerobit

CSV to HTML Table Converter

Paste your comma-separated values below to generate a ready-to-use HTML table element. The built-in RFC 4180 parser handles quoted fields, doubled quotes, embedded commas and newlines correctly. Everything runs in your browser, so no data is uploaded anywhere.

Paste your CSV or TSV data here.

Wraps the first row in <thead> with <th> cells instead of <tbody> with <td>.

HTML Output

<table>
<thead>
<tr><th>Name</th><th>Age</th><th>City</th></tr>
</thead>
<tbody>
<tr><td>Alice</td><td>30</td><td>New York</td></tr>
<tr><td>Bob</td><td>25</td><td>London</td></tr>
</tbody>
</table>

How to use the csv to html table converter

  1. Paste your CSV data into the text area, or type it directly.
  2. Select the correct delimiter if your data uses tabs, semicolons or pipes instead of commas.
  3. Check First row is header if the top row contains column names rather than data.
  4. Copy the generated HTML from the output box and paste it into your web page or template.

How the CSV parsing works

The converter reads your input character by character following RFC 4180 rules. When it encounters a double-quote at the start of a field, everything until the next unescaped double-quote is treated as literal content. Two consecutive double-quotes inside a quoted field resolve to a single quote character. Commas and line breaks inside quoted fields do not split the cell.

For example, the input "Smith, Jr.""s house",123 produces two cells: Smith, Jr."s house and 123. The parser tracks whether it is inside quotes, so embedded newlines are preserved exactly as typed.

HTML structure produced

When the header option is enabled, the first row is wrapped in a <thead> block using <th> elements. All subsequent rows go into a <tbody> block using <td> elements. Without the header option, every row becomes a <tr> inside <tbody> with <td> cells.

Cell values are escaped for safe HTML output. Ampersands become &amp;, less-than signs become &lt;, greater-than signs become &gt;, and double-quotes become &quot;. This prevents broken markup when your CSV contains HTML fragments or special characters.

Handling ragged rows

A well-formed CSV file has the same number of columns on every row. In practice, data exports often have missing trailing commas or extra fields. This tool reports ragged rows honestly rather than silently discarding data or padding with empty strings.

If row three has four fields but the first row established five columns, a note under the result lists which rows are short or long. The table still renders with whatever cells exist, so you can see the exact shape of your data and fix the source file if needed.

Common use cases

Converting a csv to html table is useful when embedding spreadsheet data into blog posts, documentation or internal dashboards without relying on JavaScript libraries. If you need other formats, you can also convert your data using tools like csv to jsonl or csv to markdown.

  • Email templates where external stylesheets are stripped and inline tables are required.
  • Static site generators that accept raw HTML blocks in Markdown files.
  • Quick prototyping before wiring up a database-driven table component.
  • Documentation wikis that support HTML tags but not CSV uploads.

Delimiter choices beyond commas

Although CSV stands for comma-separated values, many systems export tab-separated or semicolon-separated files. European locales frequently use semicolons because the comma serves as the decimal separator. Selecting the correct delimiter ensures fields are split properly.

If your source file uses tabs, choose the Tab option. The parser treats the chosen delimiter identically to how it would treat a comma under standard rules. For converting between delimiter types before generating HTML, a tsv to csv tool can normalize your data first.

Worked examples

ExampleInputResult
Simple list with headerCSV data: Name,Age,City / Alice,30,New York / Bob,25,London; Delimiter: ,; First row is header: yes<table> / <thead> / <tr><th>Name</th><th>Age</th><th>City</th></tr> / </thead> / <tbody> / <tr><td>Alice</td><td>30</td><td>New York</td></tr> / <tr><td>Bob</td><td>25</td><td>London</td></tr> / </tbody> / </table>
Quoted fields with commasCSV data: Product,Description,Price / "Widget","A small, useful thing",9.99 / "Gadget","Does ""everything""",19.50; Delimiter: ,; First row is header: yes<table> / <thead> / <tr><th>Product</th><th>Description</th><th>Price</th></tr> / </thead> / <tbody> / <tr><td>Widget</td><td>A small, useful thing</td><td>9.99</td></tr> / <tr><td>Gadget</td><td>Does &quot;everything&quot;</td><td>19.50</td></tr> / </tbody> / </table>
Tab-separated without headerCSV data: 1 2 3 / 4 5 6; Delimiter: ; First row is header: no<table> / <tbody> / <tr><td>1</td><td>2</td><td>3</td></tr> / <tr><td>4</td><td>5</td><td>6</td></tr> / </tbody> / </table>
Embedded newlinesCSV data: ID,Notes / 1,"Line one / Line two" / 2,Single line; Delimiter: ,; First row is header: yes<table> / <thead> / <tr><th>ID</th><th>Notes</th></tr> / </thead> / <tbody> / <tr><td>1</td><td>Line one / Line two</td></tr> / <tr><td>2</td><td>Single line</td></tr> / </tbody> / </table>

FAQ

Does this handle fields that contain commas?

Yes. Any field wrapped in double-quotes can contain commas, and they will not be treated as column separators. This follows the RFC 4180 standard for CSV formatting.

What happens if my rows have different numbers of columns?

The tool generates the table using the actual cells present and adds an HTML comment listing which rows are shorter or longer than the first row, so you can identify inconsistencies.

Are special characters escaped in the HTML output?

Yes. Characters like angle brackets, ampersands and quotes inside your CSV data are converted to their corresponding HTML entities to prevent broken markup or cross-site scripting issues.

Can I use a tab or semicolon as the delimiter?

Yes. Use the Delimiter dropdown to select Tab, Semicolon or Pipe. The parser applies the same quoting rules regardless of which delimiter you choose.

Is my data sent to a server?

No. The csv to html table conversion runs entirely in your browser using JavaScript. Nothing is uploaded or transmitted over the network.

How are double-quotes inside a field handled?

Inside a quoted field, two consecutive double-quote characters represent a single literal double-quote. For example, "She said ""hello""" becomes She said "hello" in the table cell.