HTML Table Generator

Use the following HTML table generator to create a table for your website. In HTML, tables are created using the <table>, <tr>, and <td> elements (as well as other optional elements). The table generator below automatically creates these tags, as well as the relevant CSS for any customization that you decide on.

Table Width:
Text Color:
Header Color:
Border Style:

Display Sample Text

The Code

Here is the code that was generated:

Customizing The HTML

Once you've generated your HTML table, you can customize it further by adding more HTML elements. The <table> element can contain a number of other HTML elements. If you add any of these, they must be in the following order:

  1. optionally a <caption> tag
  2. followed by zero or more <colgroup> tags
  3. followed optionally by a <thead> tag
  4. followed optionally by a <tfoot> tag
  5. followed by either zero or more <tbody> tags or one or more <tr> tags
  6. followed optionally by a <tfoot> tag (but there can only be one <tfoot> tag child in total)
  7. optionally intermixed with one or more script-supporting elements (i.e. either <script> tag or <template>) tag

Each <tr> element represents a row in the table. A row can have one or more <td> or <th> elements, which determine the columns in the table. The <td> element represents table data and the <th> element represents a table header.

Customizing The CSS

The CSS is the code between the <style></style> tags. These are the codes that determine styles of your table. You can change the CSS properties (or add new ones) as you like.

If you intend to use the same styles across many pages (a whole website, for example), you should move them to an external style sheet.

HTML Table Codes

You may also be interested in these copy/paste HTML table codes.

About was created in order to provide HTML tools, codes, tutorials, and other resources to help webmasters create and maintain their HTML documents. aims primarily at beginners, but may also be useful to web professionals.

About the HTML Codes

The HTML codes on this website are provided free of charge, for you to use however you wish. Feel free to modify the code to suit your own needs.

Need Hosting?

Our partner site HOSTEK provides website hosting, domain names and related products at some of the best prices on the web. If you need web hosting, check them out!