Skip to content

CSV to HTML Table

✨ Converts as you type 0 lines · 0 B

Table

Paste CSV on the left

Or copy cells from Excel or Google Sheets. The table shows up here.
Nothing to convert yet

CSV to HTML Table Converter: Paste CSV, Get a Clean Table

What Is a CSV File?

CSV stands for “comma-separated values”. It’s a plain text file where each line is a row and commas split the line into cells. Almost every spreadsheet, database and online shop can save or export one, which makes it the usual way to move a table of data from one place to another. Here’s a tiny one and the table it stands for:

The CSV:

Name,City,Visits
Ana,Lisbon,12
Ben,Leeds,7

The table:

NameCityVisits
AnaLisbon12
BenLeeds7

This tool turns CSV like that into HTML table code you can drop into a web page, a blog post or a help article. It reads commas, semicolons, tabs and pipes, so data copied from Excel or Google Sheets works too. It all happens in your browser, and nothing you paste is saved.

How to Convert CSV to an HTML Table

Four steps. Click Sample in the tool to follow along with a small product list.

Step 1 Paste or Open Your Data

  • Paste CSV into the left panel.
  • Open a file: click the upload button, or drag a .csv, .tsv or .txt file onto the tool.
  • From a spreadsheet: select the cells in Excel or Google Sheets, copy, and paste. No need to save a CSV first.

Step 2 Check How It Was Read

The table appears on the right as you type. The line under it says what the tool found, for example “5 rows × 6 columns · comma (auto) · header row”. If the columns look wrong, open Options and set the delimiter yourself. A yellow note tells you about anything odd, like a quote mark that’s never closed or rows that were shorter than the rest.

Step 3 Pick the Options

  • First row is the header: on by default. Turn it off if your data starts with a real row.
  • Style: Bordered, Lines, Modern, Plain, or No CSS for bare table code you’ll style yourself.
  • Caption: a short title that sits above the table (and helps screen reader users).
  • Turn URLs into links and Keep line breaks decide what happens to web addresses and multi-line cells.

Step 4 Copy or Download

  • Copy HTML: the table with its <style> block, ready to paste into your page.
  • CSS: just the styles, if you’d rather keep them in your own stylesheet.
  • Download: a complete .html page you can open in any browser.

Switch to the HTML Code tab to read the code before you copy it.

Header Rows and Accessibility

A table is easy to read when you can see it all at once. Someone using a screen reader hears it one cell at a time, so the code has to say which header each cell belongs to. That’s what <th> and the scope attribute are for. Here’s the code the tool writes for a small table with a caption and First column as row headers on (style set to No CSS so it’s short):

<table>
  <caption>Pricing plans</caption>
  <thead>
    <tr>
      <th scope="col">Plan</th>
      <th scope="col">Price</th>
      <th scope="col">Projects</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">Free</th>
      <td>$0</td>
      <td>3</td>
    </tr>
    <tr>
      <th scope="row">Pro</th>
      <td>$12</td>
      <td>Unlimited</td>
    </tr>
  </tbody>
</table>
  • <th scope="col"> marks a column header. A screen reader can then say “Price, $12” instead of just “$12”.
  • <th scope="row"> marks the cell that names its row, here the plan name.
  • <caption> gives the table a title that belongs to it, which is better than a paragraph above it.
  • <thead> and <tbody> split the header from the data, which also lets the browser repeat the header on every printed page.

How Quoting Works in CSV

A comma inside a value would normally start a new cell. To keep it in, the value goes inside double quotes. A quote mark inside a quoted value is written twice. Line breaks can live inside quotes too. The tool follows these rules (they come from the CSV standard, RFC 4180):

The CSV:

Item,Note
"Desk lamp, brass",Has a comma
"Cushion ""Sand""",Has quote marks
"Wool throw
(gray)",Has a line break

What you get:

ItemNote
Desk lamp, brassHas a comma
Cushion "Sand"Has quote marks
Wool throw (gray)Has a line break

A few friendly extras: a space before the opening quote is fine (a, "b, c"), a byte order mark at the start of the file is ignored, an Excel sep=; first line sets the delimiter, and rows that are shorter than the others get empty cells so every column lines up. A quote mark only starts a quoted value when it’s the first thing in the cell and its closing quote comes right before the next delimiter or the end of the line. Anything else, like "Best" seller, stays as plain text. If a quote is never closed, or runs on past the end of its line without closing properly, the note tells you the line number and that quote is read as a plain character, so the rows after it stay as they are.

Copying from Excel and Google Sheets

Styling the Table

Every style is plain CSS that you can change. With CSS: In a <style> block (the default), the rules use the class name from Options (data-table unless you change it), so they won’t touch other tables on your page. Here’s what the Lines style with striped rows gives you:

.data-table { border-collapse: separate; border-spacing: 0; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; color: #1f2937; }
.data-table caption { padding: 0 0 8px; font-weight: 600; text-align: left; }
.data-table th, .data-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid #e5e7eb; }
.data-table th { font-weight: 600; }
.data-table thead th { border-bottom: 2px solid #9ca3af; }
.data-table tbody tr:nth-child(even) > * { background: #f3f4f6; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

What It Can’t Do

Going the other way? HTML Table to CSV pulls the tables out of any HTML and saves them as CSV or Excel files. To type a small table by hand, try the HTML Table Generator.

Frequently Asked Questions

How do I convert a CSV file to an HTML table?

Paste the CSV into the left panel, or click the upload button to open a .csv file (you can also drag the file onto the tool). The table shows up on the right straight away. Pick a style in Options if you like, then click Copy HTML and paste the code into your page, or click Download to save it as a complete .html file.

Can I paste straight from Excel or Google Sheets?

Yes. Select the cells in your spreadsheet, copy them, click in the left panel and paste. Spreadsheets copy cells as tab-separated text, and the tool picks up the tabs on its own. Cells with line breaks in them come through too, because Excel and Sheets put those cells in quotes when they copy.

My CSV uses semicolons. Will it work?

Yes. Auto-detect looks at the first lines and picks the comma, semicolon, tab or pipe that shows up the same number of times on each line. Excel in many European countries saves CSV files with semicolons, because the comma is their decimal mark, so when commas and semicolons both fit, the semicolon wins. A sep=; line at the top of the file (Excel adds one sometimes) settles it and isn’t shown in the table. If the guess is ever wrong, set the delimiter yourself in Options.

What happens to commas and quotes inside a value?

They work the standard CSV way. A value with a comma, a quote or a line break in it goes inside double quotes, like "Desk lamp, brass", and a quote mark inside a quoted value is written twice, like "Cushion ""Sand""". The table shows Desk lamp, brass and Cushion "Sand". If a quote mark is never closed, or runs on past the end of its line without closing properly, the tool tells you which line it’s on and reads it as a plain character, so the rows after it stay as they are. A quote in the middle of a value, like 5" screen or "Best" seller, is plain text too.

Is the table code accessible?

Yes, as long as your data has a header row. The column names go in a <thead> with <th scope="col">, so screen readers can tell people which column a cell belongs to. Tick First column as row headers when the first column names each row (like a product name), and add a caption so the table has a title. With Scroll on small screens on, the wrapper is a labelled region that keyboard users can scroll too.

Can HTML in my CSV break the page or run a script?

No. Every value is escaped, so <b> or <script> in a cell shows up as text, exactly as it is in the file. The only tags the tool adds itself are links (only for http and https addresses, when Turn URLs into links is on) and <br> for line breaks inside a cell. The preview also runs in a locked-down frame with scripts turned off.

How big can the CSV be?

Up to 5 MB, 100,000 rows and 2,500,000 cells (rows × columns). To keep the page quick, the preview and the code view show the first 1,000 rows, but Copy HTML and Download include every row. If the full code would be over 100 MB (inline styles add a lot), the tool tells you instead of freezing your browser. Keep in mind that a table with tens of thousands of rows makes a heavy web page. For that much data, a smaller summary table or a download link to the CSV is often kinder to your visitors.

Why do accents show up as é or other odd letters?

That happens when a file saved as UTF-8 was opened somewhere as Windows-1252 and then saved again. When the tool sees that pattern, a note appears with a Fix accents button that turns café back into café. Files that aren’t UTF-8 at all, which older Excel versions on Windows often save, are read as Windows-1252 automatically.

Is my data uploaded anywhere?

No. The conversion happens in your browser, and the data you paste or open isn’t saved, not even in your browser. Only your choices in Options (style, delimiter and so on) are remembered on this device, so they’re ready next time.