Skip to content
ToolPlankDEV
Text Tools
100% In-Browser Execution

Updated:

CSV to HTML Table Converter

Paste CSV, TSV or a range copied from Excel and get a clean HTML table with a thead, scope attributes and escaped cells. This csv to html table converter shows a live preview and can write plain CSS or inline styles for email. Nothing is uploaded.

Processing in browser...

Loading the tool. It runs entirely in your browser, so your data is never uploaded.

More free tools you may need next.

Quick Guide

How to use CSV to HTML Table

Simple step-by-step instructions to get the exact output you need.

  1. 01

    Paste your data

    Paste CSV or TSV into the left box, copy cells from Excel or Google Sheets and paste them, or open a .csv file. Example loads a small sales table with commas and a quoted value.

  2. 02

    Pick a style

    Choose Bare HTML for a CMS, Simple CSS or Striped CSS for a page, or Email, inline styles for a newsletter. Add a caption, a class name and decide whether the first row is the header.

  3. 03

    Check the preview

    The code and a live preview update as you type. The preview is the table as a browser draws it with the style you chose. Notes appear if short rows were padded or empty lines skipped.

  4. 04

    Copy or download

    Press Copy HTML to paste the code into your page or email, or Download to save a complete table.html file.

How to convert CSV to an HTML table

A CSV file is plain rows of values. An HTML table is the same grid written as tags. To convert csv to an html table, the tool reads each row, splits it into cells with the separator it detects, and writes a <tr> for each row and a cell tag for each value. Take this CSV:

Text
Product,Units
Desk lamp,1200
Chair,85

With Bare HTML and the caption Stock, it becomes:

HTML
<table>
  <caption>Stock</caption>
  <thead>
    <tr>
      <th scope="col">Product</th>
      <th scope="col">Units</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Desk lamp</td>
      <td>1200</td>
    </tr>
    <tr>
      <td>Chair</td>
      <td>85</td>
    </tr>
  </tbody>
</table>

The status line reports 2 rows and 2 columns. Rows counted are data rows, so the header row is not included.

Accessible table markup: thead, scope and caption

The header row is written inside <thead> and its cells use <th scope="col">. Screen readers use that to announce a column name before each value, so a reader hears Units, 1200 and not just 1200. The caption is the table's title and is read first. Turn on First column is a row header and the first cell of every row becomes <th scope="row">, which suits tables where each row is named, such as a price list.

Turn First row is the header off for data with no header. The table then has only a <tbody> and no <th> cells. That is accurate markup, but it gives assistive software less to work with, so keep a header whenever the data has one.

Special characters and line breaks are escaped

A cell can contain characters that mean something in HTML. If they were copied into the table as they are, a cell holding a tag would be read by the browser as markup. The tool replaces the ampersand, the angle brackets and the double quote with their entities, and turns a line break inside a quoted cell into <br>:

HTML
<td>R&amp;D &lt;team&gt;</td>
<td>Said &quot;hi&quot;<br>then left</td>

That output came from the cells R&D <team> and a quoted cell that contained a line break. If you need to escape or decode entities in other text, HTML Encoder and HTML Decoder do that on their own.

CSV to HTML table for email, with inline styles

Some email apps ignore or remove a style block in the message. The usual fix is to put the style on every tag. The Email, inline styles preset does that, so the table keeps its borders and padding without a style block. For a two-column table the first body row looks like this:

HTML
<tr>
  <td style="border:1px solid #d0d5dd;padding:8px 12px;text-align:left;">Pen</td>
  <td style="border:1px solid #d0d5dd;padding:8px 12px;text-align:right;">$2.50</td>
</tr>

The result is longer than a table with a style block, which is the cost of that approach. Send yourself a test message before you rely on it, because email apps differ and no converter can promise how each will draw it.

Convert an Excel or Google Sheets range to an HTML table

Cells copied from Excel or Google Sheets reach the clipboard as text with a tab between columns. Paste them into the box and the tool detects the tab on its own, so no export step is needed. The Separator menu lets you force a comma, semicolon or tab when the detection guesses wrong, which can happen if the first line has no separator at all.

Only the values come across, not the formatting. Cell colors, merged cells and formulas are not part of the clipboard text. For the other direction, from a table on a web page back to a spreadsheet file, use HTML Table to CSV.

Styles and options explained

  • Bare HTML: only the table tags, with no class or style. Use it when your site or CMS already styles tables.
  • Simple CSS: a short style block with collapsed borders, padding and a shaded header, plus a class on the table. The class defaults to data-table.
  • Striped CSS: the same, with every other body row shaded.
  • Email, inline styles: all styling on the tags and no style block or class.
  • Right-align numbers: a column is aligned right when every non-empty cell in it is a number, such as 1200, -2.5, 3% or $18,000.00. A date or an ID with letters is left alone. Bare HTML has no styling, so this has no effect there.
  • Caption and class name: the caption is written as a caption element. The class name is cleaned to letters, digits, dashes and underscores.
  • Separator: Detect looks at the first line. Choose comma, semicolon or tab to override it.

Do you need the same data as a Markdown table instead? CSV to Markdown writes it, and HTML Table to Markdown converts a table that already exists on a page. If you have several CSV files with the same columns, Merge CSV Files joins them first.

CSV to HTML table in Python

With the pandas package installed, one line writes a table:

Python
import pandas as pd

df = pd.read_csv('data.csv')
print(df.to_html(index=False))

Pandas escapes cell text by default and adds a dataframe class. It does not add scope attributes, a caption or email-ready styles, so you edit the result afterwards. This page produces those directly and lets you see the table before you copy it.

Limits

  • The tool writes a static table. It adds no sorting, search or paging scripts.
  • Merged cells cannot be created from CSV, so every row has the same number of cells. Short rows are padded with empty cells and the notes tell you how many.
  • Empty lines are skipped, and cells are trimmed of spaces at both ends.
  • Links and formatting in a cell are written as plain text, not as tags.
  • Data is limited to 1,000,000 cells and 2,000 columns. A very long table is shown in the preview as its first 200 rows, while the code, Copy and Download contain all of it.
  • Cells that begin with = + - or @ are kept as text. That is correct for a web page. Check data from sources you do not trust before you paste the same values into a spreadsheet.

Your data is converted in your browser. It is not uploaded or stored. See the Privacy Policy for details.

Frequently Asked Questions

Technical Q&A for CSV to HTML Table

Common questions about edge cases, character encoding, and privacy guarantees.

Paste your CSV into the left box. The HTML table code appears on the right and a live preview below. Press Copy HTML to use it, or Download to save a table.html file.

Yes. Copied cells arrive as tab-separated text, and the tool detects the tab by itself. Only the values are used, not colors, merged cells or formulas.

Choose Email, inline styles. Every tag then carries its own style, so the table does not depend on a style block that some email apps remove. Send a test message to check it in the apps you care about.

It uses the markup screen readers rely on: a thead for the header row, scope attributes on header cells and an optional caption. You can also make the first column a row header. Whether the whole page is accessible depends on the rest of it.

Yes. The ampersand, angle brackets and double quote are written as entities, so a cell that contains a tag shows as text and does not become markup. Line breaks inside a cell become br tags.

Read the file with pandas.read_csv and call to_html(index=False) on the result. Pandas escapes the text but does not add scope attributes or a caption, so this page gives you a more complete table to start from.

On, the first row is written as a thead with th cells. Off, every row goes into the tbody as ordinary td cells. Keep it on whenever your data has column names.

A column whose cells are all numbers, percentages or currency amounts is aligned right so the digits line up. Turn off Right-align numbers to keep everything left. Bare HTML has no styling, so it never aligns anything.

Yes. The separator is detected from the first line, and the Separator menu lets you choose comma, semicolon or tab yourself. Fields in double quotes can contain the separator.

No. The conversion and the preview run in your browser, and nothing is sent to a server.