1. Home
  2. Tools
  3. HTML table generator

Free · no sign-up · runs in your browser

HTML Table Generator

Type into the grid — or paste cells from Excel, Google Sheets or a CSV — pick a style, and copy clean, accessible HTML table code with a live preview.

Table data — click a cell to type, or paste from Excel / CSV
HTML code

In shortSet the rows and columns, type into the grid (or paste from Excel, Google Sheets or CSV), choose header, border and stripe options, then copy the generated <table> code. The output uses <thead>, <tbody> and scope attributes for accessibility.

How to use the HTML table generator

  1. Set the size. Choose the number of rows and columns.
  2. Fill in the cells. Click a cell and type, or paste a block of cells from Excel or Google Sheets. Use Paste CSV… for CSV text.
  3. Style it. Toggle header row, borders, striped rows, caption and header colour, or untick Include CSS to style it yourself.
  4. Copy the code. Copy the HTML or download it as a complete page.

The structure of an HTML table

<table>
  <caption>Pricing</caption>
  <thead>
    <tr><th scope="col">Plan</th><th scope="col">Price</th></tr>
  </thead>
  <tbody>
    <tr><td>Free</td><td>$0</td></tr>
  </tbody>
</table>

<tr> is a row, <th> a header cell and <td> a data cell. Wrapping the header row in <thead> and adding scope="col" tells screen readers which header belongs to each cell — the generator does this for you.

From Excel or Google Sheets to HTML

Select the cells in your spreadsheet, copy, click the first cell of the grid here and paste. Rows and columns are added automatically. For a .csv file, open it in a text editor, copy everything and use Paste CSV…; quoted values with commas are handled.

Making tables work on phones

Wide tables overflow small screens. Wrap the table in <div style="overflow-x:auto"> so it scrolls sideways instead of breaking your layout. Use tables for tabular data only — not for page layout.

Edit the generated table further in the online HTML editor, or check it with the HTML validator.

Private by design: this tool runs entirely in your browser. Nothing you paste or open is uploaded to a server.

Frequently asked questions

How do I create a table in HTML?

Use <table> with a <tr> for each row and <td> for each cell (<th> for headers). This generator writes that code for you from a grid.

Can I convert Excel to an HTML table?

Yes. Copy cells in Excel or Google Sheets and paste them into the grid; the HTML updates instantly.

How do I add borders to an HTML table?

Tick Borders — it adds border: 1px solid #ddd to each cell and border-collapse: collapse to the table.

Can I get the table without CSS?

Yes, untick Include CSS to get only the <table> markup with a class you can style yourself.

Does it support merged cells?

Not in the grid. Add colspan="2" or rowspan="2" to a cell in the generated code by hand.

Related tools & guides

Updated 2026-10-22 · by the htmlonline.dev team