CSV to HTML Table

Paste CSV and copy semantic HTML table markup for a web page, an email or a CMS. A preview shows the rendered table, and the conversion stays inside your browser.

CSV → HTML

Input

Settings

History

Load from URL

Uses for a generated HTML table

HTML tables are still the right tool for tabular content on the web, and writing <tr> and <td> by hand for more than a few rows is slow and error-prone. Generating the markup from CSV is handy for:

  • Pricing, specification or comparison tables in a CMS (WordPress, Ghost, Webflow) that accepts raw HTML.
  • Reports in HTML email, where tables remain the most reliable layout tool.
  • Static documentation pages and internal dashboards.
  • Pasting data into tools that sanitise everything except basic HTML.

The markup you get

The output is a single <table> with a <thead> containing one <tr> of <th> cells and a <tbody> with one <tr> of <td> cells per CSV row, indented two spaces per level. There are no classes, IDs or wrapper elements, so the table inherits your site’s CSS.

  • Every value is HTML-escaped: <, >, & and quotes are written as entities, so data such as <b>x</b> shows up as text instead of becoming markup. That also prevents script injection from untrusted CSV.
  • Line breaks inside quoted cells become <br>.
  • Columns where every non-empty value is numeric (129.90, 1,234, -5, 15%) get style="text-align: right" on their <td> cells, so figures line up. Header cells are left as they are.
  • Short rows are padded with empty <td> cells so every row has the same number of columns.

The CSV is parsed with RFC 4180 rules, so quoted commas, doubled quotes and multi-line cells are handled before any HTML is generated.

First row is a header

With First row is a header on (the default), the CSV’s first row becomes the <th> cells in <thead>. Turn it off for header-less data: the table gets generated headings Column 1, Column 2, …, and every CSV row goes into <tbody>. Screen readers rely on <th> to announce columns, so keeping a real header row is better for accessibility.

Styling, preview and limits

Use the preview tab to see the rendered table before copying. Styling is left to you; a minimal starting point is table { border-collapse: collapse } th, td { border: 1px solid #ccc; padding: 4px 8px }. Merged cells (colspan, rowspan) and captions are not generated, because CSV cannot express them; add them by hand where needed.

To tidy or re-indent the markup later, use the HTML formatter. If your destination understands Markdown, a Markdown table is shorter to maintain. Your CSV is processed on your own device.

Values are copied as written: the converter does not reformat numbers, dates or currency, so 1,249.00 appears exactly like that. Format figures in the spreadsheet before exporting if the page should show them differently.

Examples

Price list with numbers

Seats and Price contain only numbers, so their cells are right-aligned; the quoted “Email, chat” stays in one cell.

Input
Plan,Seats,Price (USD),Support
Starter,3,19.00,Email
Team,10,79.00,"Email, chat"
Business,50,"1,249.00",Priority
Output
<table>
  <thead>
    <tr>
      <th>Plan</th>
      <th>Seats</th>
      <th>Price (USD)</th>
      <th>Support</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Starter</td>
      <td style="text-align: right">3</td>
      <td style="text-align: right">19.00</td>
      <td>Email</td>
    </tr>
    <tr>
      <td>Team</td>
      <td style="text-align: right">10</td>
      <td style="text-align: right">79.00</td>
      <td>Email, chat</td>
    </tr>
    <tr>
      <td>Business</td>
      <td style="text-align: right">50</td>
      <td style="text-align: right">1,249.00</td>
      <td>Priority</td>
    </tr>
  </tbody>
</table>
Open this example in the tool

Untrusted data is escaped

Angle brackets and ampersands become entities, so the script tag is displayed as text and never runs.

Input
username,comment
mallory,<script>alert(1)</script>
ben,Tom & Jerry fan
Output
<table>
  <thead>
    <tr>
      <th>username</th>
      <th>comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>mallory</td>
      <td>&lt;script&gt;alert(1)&lt;/script&gt;</td>
    </tr>
    <tr>
      <td>ben</td>
      <td>Tom &amp; Jerry fan</td>
    </tr>
  </tbody>
</table>
Open this example in the tool

Header-less rows

Generated Column 1 to Column 3 headings are added and both rows go into the table body.

Input
2026-09-14,checkout,1840
2026-09-14,search,95
Output
<table>
  <thead>
    <tr>
      <th>Column 1</th>
      <th>Column 2</th>
      <th>Column 3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>2026-09-14</td>
      <td>checkout</td>
      <td style="text-align: right">1840</td>
    </tr>
    <tr>
      <td>2026-09-14</td>
      <td>search</td>
      <td style="text-align: right">95</td>
    </tr>
  </tbody>
</table>
Open this example in the tool

Common errors and how to fix them

ErrorCauseFix
This quoted field is never closed
Explained
An opening quote in the CSV has no closing quote.Close the quote; inside a quoted field, write a literal quote as “”.
Row has 5 fields, expected 4; the extra fields are kept in additional columns
Explained
A warning: a row has more fields than the header, usually because of an unquoted comma in a value.Quote the value that contains the comma so it stays in one cell.
The table appears without bordersThe generated markup carries no styling on purpose.Add CSS for table, th and td in your page or email template.

Frequently asked questions

Is the HTML safe to embed?

Cell contents are HTML-escaped, so markup in the CSV is shown as text rather than executed.

Why do some cells have style="text-align: right"?

They belong to columns containing only numbers. Right alignment makes figures easier to compare; delete the attribute if you prefer.

Does the output include CSS classes?

No. The table is plain semantic HTML, so you can add your own classes or let existing styles apply.

Can I use it for HTML email?

Yes. The markup is simple enough for email clients; add inline styles for borders and padding because many clients ignore style sheets.

Related tools