Free online tool

Free Online HTML Table Generator

Type or paste data into a grid and get clean, escaped HTML table code with headers, alignment and optional CSS, plus a live preview. Runs in your browser.

HTML Table GeneratorFree online tool. Runs in your browser.
Live

Writing an HTML table by hand means typing the same row and cell tags again and again, and one missing closing tag can scramble a whole page. This generator lets you edit your data in a grid, set the options you care about and copy tidy code. It can start from cells pasted out of Excel or Google Sheets, and everything is escaped for you so that your text cannot break the page.

Working in the grid

The editor shows your table as a grid of boxes. Type into any cell, add or remove rows and columns with the buttons, and set the alignment of each column with the small L, C and R buttons above it. You can paste a block of cells straight into a box and the whole table fills in, or use the paste area for CSV, tab-separated or pipe-separated data. Tables of up to 200 rows and 30 columns are supported.

What the options do

Option Effect on the code
First row is a header Uses thead and th cells with scope=”col”
First column is a row header Uses th with scope=”row” in each row
Last row is a footer Puts the final row in tfoot, for totals
Caption Adds a caption element describing the table
Include CSS Adds a short style block with basic, striped or bordered looks
Indent Two spaces, tabs or minified

How to use it

  1. Enter your data in the grid, or paste it from a spreadsheet.
  2. Choose whether the first row is a header and set column alignment.
  3. Add a caption if the table needs a title for readers using assistive technology.
  4. Pick a style, or choose none if your site already has CSS for tables.
  5. Copy the HTML, or download a complete page that contains it.

A worked example

With the header row Product and Price, and a row with Pen and 1.20, where the Price column is right-aligned, the code is a table element with a thead holding two th cells, the second marked style=”text-align:right”, and a tbody holding two td cells. Because it uses the scope attribute, a screen reader can announce “Price” when it reads the number 1.20, which is much more useful than a bare figure.

Why escaping matters

If a cell contains a less-than sign, an ampersand or something that looks like a tag, copying it into HTML unchanged could break the layout or even run unwanted code. The generator converts those characters into safe entities, so a cell that says <b>sale</b> appears on your page as that exact text. The CSS class name is also cleaned so that only letters, digits, hyphens and underscores remain, and the preview is built from your data rather than by running the generated code.

Tables that everyone can use

A table should show data that has rows and columns, not lay out a page. Give it a header row, a caption when the purpose is not obvious, and keep cells short. Avoid merging cells where you can, since they confuse screen readers, and make sure the table scrolls sideways on narrow screens by placing it inside a container with horizontal overflow. Colour alone should never carry meaning, so support stripes or shading with text.

Limits

This tool makes simple grids. It does not create merged cells, nested tables or advanced features such as sorting. Alignment uses inline styles by default, which is the current practice; the older align attribute is available when you need to support very old systems. The CSS included is a small starting point, and you should adapt colours and spacing to your own site. Test the result in your page, and remember that long tables can be hard to read on a phone.

Prepare data with the CSV to Excel converter, format a document in the Markdown previewer, or experiment with the page in the HTML, CSS and JavaScript playground. The guide to HTML, CSS and JavaScript explains how the three fit together, and the HTML course teaches page structure from scratch.

Putting the table on a page

Paste the code into the HTML of your page where the table should appear. If your site is built with WordPress or another system, use the block or field that accepts custom HTML. Wrap wide tables in a scrolling container so that phones can swipe sideways, and test with a screen magnifier or zoom to make sure nothing is cut off. Update the data in the grid and copy again whenever the numbers change.

Key takeaways

  • Edit in a grid, paste from a spreadsheet and copy tidy code.
  • Header cells use scope attributes so screen readers read them properly.
  • All text is escaped, so cells cannot break or inject into the page.
  • CSS is optional; leave it out if your site styles tables already.
  • Keep tables simple and test them on a small screen.

Questions

How do I make an HTML table from Excel data?

Copy the cells in Excel or Google Sheets, paste them into the paste area or directly into a grid cell, and the table fills in. Adjust headers and alignment, then copy the generated HTML. The tool converts tab-separated and comma-separated data and keeps text safe by escaping special characters.

What does the scope attribute do?

Scope tells assistive technology which cells a header applies to. A th with scope="col" labels the column below it, and scope="row" labels the row. With these, a screen reader can announce the header with each value, so people who cannot see the layout still understand the data.

Is it safe to put any text in the cells?

Yes. Characters such as the less-than sign, the greater-than sign and the ampersand are converted into HTML entities, so your text is displayed as written and cannot be read as a tag. This protects your page from broken layouts and from unwanted script injection when content comes from other people.

Can I make a table with merged cells?

This generator creates simple grids and does not produce colspan or rowspan. Merged cells are hard for screen readers and often break on small screens. If you truly need them, generate the base table here and add the attributes by hand, then test the result carefully.

Do I have to include the CSS?

No. The default is HTML only, which lets your own style sheet control the look. If you want something quick, choose basic, striped or bordered, and a short style block is added above the table. You can move that CSS into your site stylesheet later.