nutilz
โŠž

HTML Table Generator

Build tables visually โ€” export as HTML, Markdown or CSV

Rows:4
Columns:4
Max 20 rows ร— 10 columns
TH
1
2
3
<table class="table">
  <thead>
    <tr>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </tbody>
</table>

๐Ÿ”’ Runs entirely in your browser. Your table data never leaves your device.

How to Use This HTML Table Generator

Building a table by hand means counting columns, nesting <thead> and <tbody> in the right order, and making sure every <th> is in the right place. This generator does all of that in under 60 seconds:

  1. Set dimensions. Click + or โˆ’ next to Rows and Columns. The default is 4 ร— 4 โ€” go up to 20 rows and 10 columns.
  2. Fill in your data. Click any cell and type. Press Tab to move to the next cell, or click directly.
  3. Configure styling. Toggle "First row as header" to emit <th> elements. Enable Striped, Bordered, or Responsive for Bootstrap-compatible output. Add a Caption for accessibility.
  4. Choose format. Click HTML, Markdown, or CSV above the output panel. Hit Preview to see your table rendered live.
  5. Copy and paste. Click the Copy button and drop the code directly into your HTML file, Markdown document, or spreadsheet application.

All processing happens locally โ€” nothing is sent to a server and no data is stored.

When to Use HTML Tables (and When Not To)

The right moment to reach for an HTML table is when your data is genuinely tabular โ€” every row represents a record and every column represents the same attribute across all records. Good examples:

  • Pricing tables: Three tiers (Basic, Pro, Enterprise) ร— five features (price, users, storage, support, API). The grid relationship is the whole point.
  • Schedules and timetables: Columns are days, rows are time slots.
  • Statistical data: Countries ร— GDP, population, area, and life expectancy.
  • Comparison guides: Feature matrices, spec sheets, and compatibility charts.

Where you should not use a table:

  • Page layout: Using <table> rows and columns to arrange a header, sidebar, and footer was a practice from the late 1990s. Modern CSS Grid and Flexbox handle layout โ€” tables impose terrible maintenance costs and break screen readers.
  • Single-column data: If you have one column, you want a <ul> or <ol>, not a table.
  • Image galleries: Arranging images in a grid is a visual layout choice, not relational data โ€” CSS Grid is the right tool.

Google and other search engines also reward semantic HTML. A table used for data improves crawlability because bots can understand the relationship between headers and cells. A table used for layout confuses both crawlers and accessibility tools.

HTML Table Structure Explained

Understanding what each element does helps you write better markup โ€” with or without a generator.

<table>
The outer container. Add a class attribute here for Bootstrap utility styles (e.g. class="table table-striped").
<caption>
Goes immediately inside <table>. Screen readers announce the caption before reading any cells โ€” think of it as an alt attribute for the whole table. Always add one to data tables.
<thead>
Groups header rows. Browsers repeat <thead> on each page when the table is printed โ€” essential for long reports. Only one per table.
<tbody>
Groups data rows. You can have multiple <tbody> sections to segment large datasets logically (e.g. one per quarter).
<th>
A header cell. Browsers render it bold and centered by default. Add scope="col" for column headers and scope="row" for row headers โ€” this is critical for screen reader users navigating large tables.
<td>
A data cell. Spans one row and one column by default. Use colspan and rowspan to merge cells (hand-write these โ€” the generator produces simple tables with no merging).

A minimal, semantically correct table looks like this:

<table>
  <caption>Monthly Sales</caption>
  <thead>
    <tr>
      <th scope="col">Month</th>
      <th scope="col">Revenue</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>January</td>
      <td>$12,400</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$14,100</td>
    </tr>
  </tbody>
</table>

Making Your Table Responsive

A fixed-width table overflows its container on small screens โ€” the content is cut off or the browser shrinks the text to an unreadable size. The simplest fix is a scroll wrapper:

<div class="table-responsive">
  <table class="table">...</table>
</div>

This sets overflow-x: auto on the wrapper so narrow screens can scroll the table horizontally while the rest of the page layout stays intact. It is the Bootstrap convention, but it works without Bootstrap if you add style="overflow-x:auto" manually.

For tables where horizontal scrolling is awkward โ€” like simple name/value tables on mobile โ€” a card-layout technique works better. Each row becomes a labeled card via CSS display: block and data-label attributes on each <td>:

@media (max-width: 600px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { position: absolute; left: -9999px; }
  td { border: none; position: relative; padding-left: 50%; }
  td::before {
    content: attr(data-label);
    position: absolute; left: 0;
    font-weight: bold; width: 45%;
  }
}

The scroll wrapper (enabled by the Responsive checkbox above) is best for wide data tables with many columns. The card layout is best for simple 2โ€“4 column tables where each row is a self-contained record.

Bootstrap Tables: A Quick Reference

Bootstrap 5 includes a comprehensive table system. All classes go on the <table> element (except table-responsive, which goes on the wrapper <div>):

  • table โ€” Required base class. Resets browser defaults and adds consistent padding.
  • table-striped โ€” Alternating background on even rows via :nth-child.
  • table-bordered โ€” Borders on all sides of every cell.
  • table-borderless โ€” Removes all borders for a clean, minimal look.
  • table-hover โ€” Highlights rows on hover.
  • table-sm โ€” Reduces cell padding for compact tables.
  • table-dark โ€” Dark background with light text.
  • table-responsive โ€” On the wrapper div, not the table. Enables horizontal scroll on all screen sizes.
  • table-responsive-md โ€” Enables horizontal scroll only below the md breakpoint (768 px). Replace with sm, lg, or xl as needed.

A common combination for data tables:

<div class="table-responsive">
  <table class="table table-striped table-bordered table-hover">
    ...
  </table>
</div>

Markdown Tables vs HTML Tables

GitHub-Flavored Markdown (GFM) tables use a pipe syntax that renders in README files, pull request descriptions, wikis, and platforms like Notion and Obsidian:

| Column A | Column B | Column C |
|----------|----------|----------|
| Data 1   | Data 2   | Data 3   |
| Data 4   | Data 5   | Data 6   |

Key rules for Markdown tables:

  • The separator row (|---|) is required. The number of dashes doesn't matter.
  • Align columns: |:---| left, |:---:| center, |---:| right.
  • Pipes inside cell content must be escaped: \| (this generator handles it automatically).
  • No support for colspan, rowspan, <caption>, or scope attributes.

Use Markdown for documentation, README files, wikis, and anywhere you write plain text and don't control the final HTML. Use HTML when you need responsive behavior, Bootstrap styling, a caption, or any accessibility attributes.

Common HTML Table Mistakes to Avoid

  1. Using tables for page layout. Tables confuse screen readers, break responsive design, and hurt SEO. Use CSS Grid or Flexbox for layout.
  2. Skipping <thead> and <tbody>. Browsers tolerate the omission, but assistive technology expects the structure. Always wrap your header row in <thead>.
  3. Missing scope on <th> elements. Screen reader users navigating a large table need to hear whether a header applies to the current column or row. Add scope="col" or scope="row" accordingly.
  4. No caption. A <caption> tells assistive technology what the table is about before the user reads any cells โ€” the equivalent of alt text for images.
  5. Not escaping special characters in cell content. Angle brackets (<, >) and ampersands (&) inside cell text can break the HTML. Use HTML entities or ensure your CMS handles escaping before inserting cell content into a template.
  6. Putting table-responsive on the <table> element. Bootstrap's responsive wrapper must go on the parent <div>, not the table itself โ€” a mistake that silently does nothing.
  7. Making every table responsive unnecessarily. A two-column, three-row table embedded in a blog post doesn't need a scroll wrapper โ€” the extra DOM nesting adds complexity with no benefit on any screen size.

Frequently Asked Questions

What is an HTML table and when should I use it?โ–ผ

An HTML table is a structured grid of rows and columns used to display relational, tabular data โ€” like schedules, price comparisons, statistics, or product specifications. Use a table when your data has a clear relationship between rows and columns that would be meaningless without that structure. Avoid tables for page layout (that role belongs to CSS Flexbox and Grid) or for organizing purely visual content. Semantic HTML tables built with <table>, <thead>, <tbody>, <tr>, <th>, and <td> also improve accessibility because screen readers can announce the row and column headers for each cell automatically.

How do I make an HTML table responsive?โ–ผ

The simplest approach is to wrap your <table> inside a <div class="table-responsive"> container โ€” a Bootstrap convention that sets overflow-x: auto so the table scrolls horizontally on small screens instead of breaking the page layout. You can also use CSS media queries with display: block and data-label attributes on each <td> to convert rows into labeled cards on mobile. This generator's Responsive option adds the Bootstrap table-responsive wrapper automatically.

What is the difference between <th> and <td>?โ–ผ

<th> (table header cell) and <td> (table data cell) serve different semantic roles. A <th> element represents a header for a column or row โ€” browsers render it bold and centered by default, and screen readers announce it as a header when reading data cells. A <td> holds the actual data values. Using <th> correctly matters for accessibility: add scope="col" or scope="row" to declare whether the header applies to a column or a row, which makes complex tables far easier to navigate with assistive technology.

How do I add striped rows to an HTML table?โ–ผ

With Bootstrap 5, add the class table-striped to the <table> element: <table class="table table-striped">. Bootstrap uses CSS :nth-child pseudo-classes to alternate the background color of odd and even rows automatically. Without a CSS framework, use tr:nth-child(even) { background-color: #f2f2f2; } in your stylesheet. The Striped option in this generator adds the Bootstrap table-striped class. Striped rows significantly improve readability on wide tables with many columns.

Can I use this generator for Bootstrap tables?โ–ผ

Yes. Enable the Striped and Bordered options to add Bootstrap's table-striped and table-bordered utility classes to the generated <table> tag. Enable the Responsive option to wrap the table in Bootstrap's <div class="table-responsive"> container. You can combine all three. The generated HTML is drop-in ready for any Bootstrap 4 or Bootstrap 5 project โ€” no extra configuration required.

What is a Markdown table and how is it different from HTML?โ–ผ

A Markdown table uses pipe characters (|) and dashes (---) to define columns and a separator row. It is supported by GitHub-Flavored Markdown (GFM), GitLab, most static site generators (Jekyll, Hugo, Eleventy), and documentation platforms like Notion and Obsidian. Markdown tables are simpler to read and write in plain text but less powerful than HTML โ€” they lack row spanning, cell merging, captions, accessibility attributes, and fine-grained styling. Use a Markdown table for documentation, README files, and wikis; use an HTML table when you need responsive behavior, styling control, or accessibility features.

How do I make an HTML table accessible for screen readers?โ–ผ

Four steps improve table accessibility: (1) Use <th> elements for header cells and add scope="col" (column headers) or scope="row" (row headers). (2) Add a <caption> element immediately after the opening <table> tag to give the table a title โ€” screen readers read the caption first. (3) For tables with merged cells, use headers and id attributes to link data cells to their headers explicitly. (4) Never use a <table> for layout โ€” only use it when the data is genuinely tabular and the row/column relationships carry meaning. This generator includes a Caption field to add a <caption> element for better screen reader support.