Convert HTML Tables to Markdown Pipe Tables

Convert HTML <table> elements with <thead>, <tbody>, <tr>, <th>, and <td> to Markdown pipe table syntax. Includes alignment, colspan limitations, and formatting within cells.

Lists & Tables

Detailed Explanation

HTML Tables to Markdown

HTML tables convert to Markdown pipe table syntax (part of GitHub Flavored Markdown). The pipe (|) character separates columns, and a separator row of hyphens defines the header boundary.

Basic Table Conversion

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Language</th>
      <th>Stars</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>React</td>
      <td>JavaScript</td>
      <td>200k</td>
    </tr>
    <tr>
      <td>Vue</td>
      <td>JavaScript</td>
      <td>200k</td>
    </tr>
  </tbody>
</table>

Converts to:

| Name  | Language   | Stars |
|-------|------------|-------|
| React | JavaScript | 200k  |
| Vue   | JavaScript | 200k  |

The first row becomes the header, the second row is the separator (using at least three hyphens per column), and remaining rows are data.

Column Alignment

HTML uses text-align styles or align attributes on <th>/<td>:

<th style="text-align: left">Left</th>
<th style="text-align: center">Center</th>
<th style="text-align: right">Right</th>

Converts to alignment indicators in the separator row:

| Left   | Center | Right |
|:-------|:------:|------:|

Tables Without thead

<table>
  <tr><td>A</td><td>B</td></tr>
  <tr><td>C</td><td>D</td></tr>
</table>

When there is no <thead>, the first row is treated as the header. Some converters create an empty header row instead.

Limitations

Markdown pipe tables do not support:

  • colspan / rowspan — merged cells must be flattened
  • Multi-line cell content — cells are single-line only
  • Nested tables — not possible in Markdown syntax
  • Caption<caption> content is typically placed as a paragraph above the table

For complex tables, some converters fall back to raw HTML output to preserve the structure.

Use Case

Table conversion is essential when migrating data-heavy content like API reference pages, comparison charts, pricing tables, and documentation with tabular data. Understanding the limitations helps you decide when to simplify tables or keep raw HTML.

Try It — HTML to Markdown

Open full tool