Skip to content
MoneyDeck

HTML Table Generator

Turn CSV, spreadsheet cells or tab-separated data into clean HTML table code

Updated · Free, no signup

Wraps the first cell of each body row in <th scope="row">.

Useful for email templates and editors that remove <style> blocks.

HTML code

<table>
  <thead>
    <tr>
      <th scope="col">Plan</th>
      <th scope="col">Monthly price</th>
      <th scope="col">Users</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Starter</td>
      <td>$9</td>
      <td>1</td>
    </tr>
    <tr>
      <td>Team</td>
      <td>$29</td>
      <td>10</td>
    </tr>
    <tr>
      <td>Business</td>
      <td>$79</td>
      <td>50</td>
    </tr>
  </tbody>
</table>

Body rows

3

Columns

3

Total cells

12

  • Detected a comma-separated table with 4 rows and 3 columns.
  • Tip: add a caption — it gives screen-reader users a title for the table.

About the HTML Table Generator

This HTML table generator converts rows of data into ready-to-paste HTML table markup. Paste CSV, copy a range of cells straight from Excel or Google Sheets (which arrive tab-separated), or type pipe-separated rows, and the tool writes a properly structured <table> with <thead>, <tbody>, header cells and an optional caption.

It is meant for bloggers adding a comparison table to a CMS that only accepts HTML, developers building documentation or email templates, and anyone who needs table code without hand-typing dozens of <tr> and <td> tags. Header cells get scope attributes and a caption can be added, which helps screen-reader users understand the table. Turn on inline borders for email clients and editors that strip stylesheets.

The delimiter is detected automatically from the first line, quoted CSV fields (including commas and line breaks inside quotes) are handled per RFC 4180, and every cell is HTML-escaped so characters like < and & display correctly instead of breaking your page. Rows with fewer cells are padded so the table stays rectangular.

How to use the html table generator

  1. 1Paste CSV, or copy cells from Excel or Google Sheets and paste them.
  2. 2Leave the separator on automatic or pick it explicitly.
  3. 3Choose whether the first row is a header and add an optional caption.
  4. 4Turn on inline borders if the table is going into an email.
  5. 5Copy the HTML code into your page, CMS or template.

Formula and method

The input is split into rows at line breaks and into cells at the chosen separator. In automatic mode the separator is whichever of comma, tab, semicolon or pipe appears most often in the first line outside quotes. Fields wrapped in double quotes may contain separators, line breaks and doubled quotes ("") exactly as RFC 4180 defines for CSV; surrounding spaces are trimmed and fully empty lines are skipped.

Each row is padded to the width of the widest row. If the first row is a header it becomes a <thead> row of <th scope="col"> cells; the remaining rows go into <tbody> as <td> cells (or a <th scope="row"> first cell when row headers are enabled). The characters &, <, > and " are converted to HTML entities so the content is displayed literally.

Worked examples

Pricing table from CSV

Three CSV lines with two fields each: the first line becomes the header row with two <th> cells, and the other two lines become body rows. 3 rows × 2 columns = 6 cells in total.

Spreadsheet paste with a caption, minified

Cells copied from a spreadsheet are separated by tabs, which the automatic detector picks up. The caption is placed first inside <table>, and minified output joins everything onto one line.

Quoted CSV with commas, escaping and a short row

The quoted field "Smith, J." keeps its comma, < is escaped as &lt;, and the doubled quotes become "hi" (escaped as &quot;). With the header off, all three lines are body rows; the last has only two fields and gets one empty cell, so the table is 3 × 3 = 9 cells.

Frequently asked questions

How do I convert an Excel table to HTML?+

Select the cells in Excel or Google Sheets, copy them, and paste into the data box. Spreadsheets copy cells as tab-separated text, which this generator detects automatically and turns into a complete HTML table with header and body rows.

What is the difference between thead, tbody and th?+

<thead> groups the header rows and <tbody> the data rows, which helps browsers, printing and assistive technology. <th> marks a header cell; its scope attribute ("col" or "row") tells screen readers which cells it describes, while <td> holds ordinary data.

How do I add borders to an HTML table?+

With CSS: table { border-collapse: collapse; } td, th { border: 1px solid #ccc; padding: 6px 10px; }. If your editor or email client strips stylesheets, enable the inline borders option and the styles are written on each cell instead.

Why are some characters turned into &amp; or &lt;?+

Characters such as <, > and & have special meaning in HTML. Escaping them as entities makes the browser show them as text instead of treating them as tags, which also prevents user data from injecting markup into your page.

Can a CSV cell contain commas or line breaks?+

Yes, if the cell is wrapped in double quotes, as RFC 4180 specifies — "Smith, J." stays one cell. To include a quote character inside a quoted cell, double it: "He said ""hi""" becomes He said "hi".

Related tools