1. Home
  2. Developer
  3. Excel to HTML Table

Excel to HTML Table

Paste cells copied from Excel and get the HTML table code.

Runs in your browser · No upload
Preview
BranchJan salesFeb salesNote
Seoul1,200,0001,350,000New <opening>
Busan850,000910,000Promotion (3 days)
Daegu720,000Under renovation
HTML code
<table> <thead> <tr> <th scope="col">Branch</th> <th scope="col" style="text-align: right;">Jan sales</th> <th scope="col" style="text-align: right;">Feb sales</th> <th scope="col">Note</th> </tr> </thead> <tbody> <tr> <td>Seoul</td> <td style="text-align: right;">1,200,000</td> <td style="text-align: right;">1,350,000</td> <td>New &lt;opening&gt;</td> </tr> <tr> <td>Busan</td> <td style="text-align: right;">850,000</td> <td style="text-align: right;">910,000</td> <td>Promotion<br>(3 days)</td> </tr> <tr> <td>Daegu</td> <td style="text-align: right;">720,000</td> <td style="text-align: right;"></td> <td>Under renovation</td> </tr> </tbody> </table>
Rows
4
Columns
4
Numeric columns
2, 3

Every <, >, & and quote in the cells is escaped, so cell text never runs as code. class and id keep letters, digits, - and _ only.

The pasted table is processed in your browser and never sent to a server.

How to use

  1. In Excel or Google Sheets, select the cells, copy them (Ctrl+C) and paste them (Ctrl+V) into the input box.
  2. Check the table in the preview and pick your options: whether the first row is a header, whether numeric columns are right-aligned, and which style to add.
  3. Copy the HTML code into your blog, forum, email or web page, or save it with Download .html.

CSV text also works in the same box. The delimiter defaults to auto-detect: if there is a tab it uses tab (Excel copy), otherwise whichever of comma and semicolon appears more.

Options

Option What it does
First row is the header Makes the first row <th> cells in <thead> and the rest <td> cells in <tbody>
scope attribute on th Writes <th scope="col"> so screen readers know it is a column header
Trim spaces around cells Removes leading and trailing spaces from each value
Line breaks as br Turns line breaks inside an Excel cell (Alt+Enter) into <br>. When off they become one space
Put nbsp in empty cells Fills empty cells with &nbsp; so some editors do not collapse them
Right-align numeric columns Right-aligns a column when every value below the header is a number
Style: None Plain table code with no decoration
Style: Inline style Adds style to each tag so borders show without CSS. For email and forums
Style: style block Puts a <style> block before the table and styles it through a class (default excel-table) with borders and zebra rows
caption, class, id Set the table title and attributes

Sample result

Converting the sample in the box (4 rows, 4 columns, columns 2 and 3 numeric) gives:

  • The first row Branch, Jan sales, Feb sales, Note becomes <th scope="col"> cells in <thead>.
  • The two columns that hold only values like 1,200,000 and 850,000 are treated as numeric and get style="text-align: right;". The header cells follow the same alignment.
  • New <opening> becomes New &lt;opening&gt; and is shown as text.
  • The cell with a line break, Promotion and (3 days), becomes Promotion<br>(3 days).
  • Daegu’s empty February cell stays as <td style="text-align: right;"></td>.

Escaping and safety

Every <, >, &, " and ' in a cell becomes &lt;, &gt;, &amp;, &quot; or &#39;. A cell containing something like <script> therefore comes out as text, not code. For class and id only letters, digits, - and _ are kept.

How numbers are recognised

1,234, -5.2, 12%, $3,000 and .5 count as numbers. Values with a leading zero such as 007 (codes, postal codes), dates (2024-01-01) and malformed thousands like 1,23 do not, so they are not aligned. If any value in a column is not a number, that column is left alone.

The format of Excel’s clipboard text

Excel puts copied cells on the clipboard as text split by tabs and line breaks. A cell that contains a line break, tab or double quote is wrapped in double quotes with inner quotes doubled. This tool reads that exact rule, so multi-line cells land in one cell. In merged cells only the first cell has a value and the others are empty; rowspan and colspan are not generated.

Frequently asked questions

How do I put an Excel table in a blog post?

If your blog supports HTML, choose Inline style and paste the code in HTML mode. If your blog theme already styles tables, None fits better.

Is there a size limit?

Up to 5,000 rows and 200 columns are converted, and the preview shows the first 50 rows. The input can be up to 2MB.

Can I go the other way, from an HTML table to Excel?

The HTML Table to CSV tool handles that direction.

Can I get a Markdown table instead?

Use the Markdown Table Generator.

Related tools: HTML Table to CSV, CSV Excel Converter, Markdown Table Generator, HTML Entity Converter, HTML Beautify and Minify.

The pasted table is processed in your browser and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.