All tools
Free · Private · No upload

Convert CSV to HTML Table Online

Turn a CSV file into a clean HTML <table> with <thead> and <tbody>, ready to paste into a page, an email or a CMS. The CSV is read in your browser and never uploaded.

Drop a CSV or Excel file here

CSV · XLSX · XLS · XLSM · XLSB

or paste your data below

How to convert CSV to an HTML table

Three steps from schedule.csv to an HTML table.

1. Paste or drop the CSV

Paste CSV text or drop a .csv, .tsv or .txt file; the delimiter is detected.

2. Check it in the grid

Look for cells containing < or &: they are escaped and show as text. Untick Escape HTML only if a column holds markup you want rendered.

3. Set the markup options

Keep or drop thead/tbody, escaping and minifying, add a class name, then copy the markup or download data.html.

Example: CSV in, HTML out

A workshop schedule with ampersands in the session names and a quoted field.

schedule.csv
day,time,session,room
Mon,09:00,Intro & setup,A1
Tue,14:30,"Q&A, wrap-up",B2
data.html (default options)
<table>
  <thead>
    <tr>
      <th>day</th>
      <th>time</th>
      <th>session</th>
      <th>room</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Mon</td>
      <td>09:00</td>
      <td>Intro &amp; setup</td>
      <td>A1</td>
    </tr>
    <tr>
      <td>Tue</td>
      <td>14:30</td>
      <td>Q&amp;A, wrap-up</td>
      <td>B2</td>
    </tr>
  </tbody>
</table>

The CSV quoting disappears: "Q&A, wrap-up" becomes one cell with an ordinary comma, and every & is written as &amp;, which browsers display as &.

What changes between CSV and HTML

Markup

The header row becomes <th> cells inside <thead>, the data rows go into <tbody>. Untick thead/tbody for bare <tr> rows (the first still uses <th>). Minify removes indentation and line breaks.

Escaping

&, <, >, " and ' are turned into entities, so the value Intro & setup is written as Intro &amp; setup. Untick Escape HTML only if a column holds markup you want the browser to render.

Detected delimiter: comma

The page counts commas, semicolons, tabs and pipes in the first line and splits on whichever appears most: 3 commas here. Quoted fields keep their delimiters and line breaks inside one cell.

When to convert CSV to HTML

CSV to HTML in JavaScript

TabularJS reads the CSV into a 2D array. Then every value is escaped into a <table>.

import tabularjs from 'tabularjs';

// CSV values are strings; the header row stays in data[0]
const { worksheets } = await tabularjs('schedule.csv');
const [header, ...rows] = worksheets[0].data;

const esc = (v) => String(v ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;')
  .replace(/>/g, '&gt;').replace(/"/g, '&quot;');
const tr = (cells, tag) => '<tr>' + cells.map((c) => `<${tag}>${esc(c)}</${tag}>`).join('') + '</tr>';
console.log(`<table>\n<thead>${tr(header, 'th')}</thead>\n<tbody>\n` +
  rows.map((row) => tr(header.map((_, i) => row[i]), 'td')).join('\n') + '\n</tbody>\n</table>');

TabularJS returns CSV values as strings and leaves the header in data[0]. It does not guess the delimiter: comma is the default, so pass { delimiter: ';' } for semicolon files.

npm install tabularjs MIT licensed

Frequently asked questions

Can I style the table?

The output has no inline styles. Type a class name in the class box (for example striped) and style that class in your CSS, or use a framework's class names such as Bootstrap's table.

Can the first column be a row header?

Not from the options: only the first row becomes <th>. Change the first <td> of each row to <th scope="row"> by hand if you need row headers.

Are quoted fields with commas or line breaks handled?

Yes. A field in double quotes can contain the delimiter, doubled quotes ("") and line breaks, and it still ends up in one cell. In the HTML the line break is kept inside the <td>.

Does the table come with CSS?

No. The markup is unstyled on purpose so it inherits your site's styles. Use the class option to hook it up to your CSS or a framework.

Does schedule.csv get uploaded when I convert it to HTML?

No. The CSV is read in your browser and never uploaded.