Tables are the part of Markdown people trust least, usually because they once watched a hand-written HTML table fall apart over one missed closing tag. A real HTML table is rows of <table>, <tr>, <th> and <td> markup. Writing it by hand beyond a few rows is slow and dull. It is also easy to get wrong in a way that breaks the whole grid.

The alternative is to keep the data in the format that is easy to write and proofread: a Markdown pipe table. Pipe tables are a GitHub-flavored feature, and the Markdown to HTML Converter on Ovatly supports them. The table you type as plain text comes out as a genuine HTML table for a page, a CMS field or a template.

Contents

  • Quick answer
  • The anatomy of a pipe table
  • What the converter does with a table
  • Alignment carries through
  • How to convert a Markdown table, step by step
  • Worked example: one table, both sides
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

To convert a Markdown table to an HTML table, write the table in Markdown first. Use a header row, a separator row of dashes under it, and one line per data row. Add colons in the separator row to set alignment: :--- for left, :---: for center, ---: for right. Paste the Markdown into the Markdown to HTML Converter. The output contains an HTML table built from <table>, <thead>, <tbody>, <th> and <td> elements. It is sanitized and ready to copy or download as an .html file. Markdown tables cannot express merged cells: every row has the same number of cells, and nothing spans.

The anatomy of a pipe table

A pipe table is three kinds of line. The first line is the header row: the column titles, divided by pipe characters. The second line is the separator row: a run of dashes per column. It tells the parser this is a table at all, and how many columns it has. Every line after that is a data row, with the same number of cells as the header.

The separator row does double duty: its dashes define the columns, and colons at either end of a dash run set that column's alignment. A colon on the left only means left-aligned, both ends mean centered, and the right only means right-aligned. Leave the colons out and the column takes the default.

Keep each row on a single line, because a row that wraps is a new line to the parser, not a longer cell. And give every row the same number of cells as the header. Pad with an empty cell where a value is absent, rather than letting the row run short.

What the converter does with a table

The converter renders Markdown with the marked parser, whose GitHub-flavored support includes tables. It then sanitizes the rendered HTML with DOMPurify, so the code is safe to paste into a page. A table passes both stages cleanly. The parser turns your rows into table markup. The sanitizer keeps the structure because tables are safe, ordinary markup.

Cell content converts along with the table. Inline Markdown inside a cell, such as bold text, a link or inline code, renders as the matching inline HTML inside that cell. So a table of tools with linked names and a column of short commands converts in one pass, formatting included. There is no second pass by hand through the generated rows.

Alignment carries through

Alignment is the detail people expect to lose in conversion, and it is the one that survives intact. The colons in the separator row are not decoration; they are instructions. The converter applies them to the header and body cells of the HTML table. A price column right-aligned in Markdown is right-aligned in the output, and a centered status column stays centered.

This makes the separator row worth a deliberate ten seconds. Decide each column's alignment from its data. Text reads naturally left-aligned. Short status words and numbers sit better centered or right-aligned. Mixed columns belong on the left. Set the colons once, in the source, and every future conversion keeps the decision.

How to convert a Markdown table, step by step

  1. Write the table in Markdown: header row, separator row with any alignment colons, then one line per row.
  2. Open the Markdown to HTML Converter and paste in the Markdown, the whole document or just the table.
  3. Check the sanitized preview: the table should appear as a grid, with the columns and alignment you intended.
  4. Copy the sanitized HTML, or download the .html file, and paste the table markup into its destination.
  5. View the destination page once, because your page's styles now decide the table's final width and spacing.

Worked example: one table, both sides

Here is a small table in Markdown, second column centered, third right-aligned:

| Item | Status | Count |
| :--- | :----: | ----: |
| Draft guides | Done | 12 |
| Live guides | Pending | 0 |

Converted, the same table comes out as real table markup:

<table>
<thead>
<tr>
<th align="left">Item</th>
<th align="center">Status</th>
<th align="right">Count</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">Draft guides</td>
<td align="center">Done</td>
<td align="right">12</td>
</tr>
<tr>
<td align="left">Live guides</td>
<td align="center">Pending</td>
<td align="right">0</td>
</tr>
</tbody>
</table>

The header row became the <thead> section with <th> cells. The data rows became the <tbody> with <td> cells. The separator row's three alignment choices appear on every header and body cell. Nothing about the data changed; only the clothing did. That is the value of the route: you maintain the version a human can proofread, and convert whenever you need the version a browser wants.

Limitations and honest tradeoffs

Markdown tables are simple grids, and the limits follow from that. There is no syntax for merged cells, so nothing equivalent to rowspan or colspan exists. A design that needs a cell to span two columns cannot be expressed, let alone converted. Such tables have to be written as HTML directly.

Cells hold inline content only. Bold, links and inline code are fine. A list, a paragraph break or a code block inside a cell is not. Block content squeezed into a cell will not survive as structure. A literal pipe inside a cell's text also needs care, since the pipe is the column divider. Keep cell text free of stray pipes, or the columns shift.

The usual converter limits apply too. The output is sanitized, so raw HTML mixed into the table is kept only where DOMPurify considers it safe. The fragment's final appearance depends on the destination page's styles, which the converter does not provide.

Common mistakes

  • Forgetting the separator row. Without the dash row under the header, the parser sees a paragraph of pipe characters, not a table.
  • Letting a row run short. A row with fewer cells than the header shifts or loses data. Pad with an empty cell instead.
  • Expecting merged cells. Markdown has no spanning. If the layout needs a merged header, write that table as HTML by hand.
  • Putting block content in a cell. Lists and paragraphs do not belong in cells; keep cell content to one inline line.
  • Skipping the preview. A ten-second look catches a missing separator row or a shifted column before readers do.

FAQs

Does the converter support Markdown tables? Yes. Tables are one of the GitHub-flavored features the marked parser supports in this converter. A pipe table in your Markdown renders as a real HTML table in the output. The sanitizer keeps the table structure because tables are safe markup.

How do I align a column left, center or right? Put colons in the separator row under that column: :--- aligns left, :---: centers, and ---: aligns right. No colon means the default alignment. The alignment carries through to the header and body cells in the HTML.

Can I merge cells in a Markdown table? No. Markdown table syntax has no equivalent of rowspan or colspan, so every row has the same number of cells and no cell spans another. If your data needs merged cells, build that table as HTML by hand.

What can go inside a table cell? Inline Markdown: bold, italic, links, inline code and similar single-line formatting, which renders as inline HTML inside the cell. Block content such as lists, paragraphs and code blocks does not fit in a cell and will not survive as structure.

Is my table uploaded anywhere during conversion? No. The converter runs fully in your browser, so the Markdown and the finished HTML stay on your device; the page keeps working offline once loaded.

Conclusion

A Markdown table converts cleanly when built as a simple grid. It needs a header row, a separator row with alignment colons set on purpose, one line per row, and inline content in the cells. The Markdown to HTML Converter turns that into sanitized, real table markup in one pass, in your browser. Before any converted page goes live, it deserves the wider once-over in our guide to checking converted HTML before you ship it. For more guides in this series, see our Website and Webmaster Tools guides, which pair each technique with the free tool that performs it.

References