HTML Table to Markdown Converter | thead, align, colspan / rowspan in one pass
If you have ever migrated an old blog post from HTML to Markdown, you know the pain point: every paragraph converts cleanly except for the tables, which collapse into a single column or lose their headers. This tool reads any HTML table you paste, emits GitHub Flavored Markdown, and preserves thead headers, align direction, and colspan / rowspan cell expansion in a single pass.
💡 About this tool
Most one-liner HTML-to-Markdown converters cannot distinguish header rows from body rows, so they emit every row as | cell | cell | without the separator line. A Markdown renderer reading that output treats the first row as data and renders nothing as a header. The result looks wrong on GitHub README, Hugo, Astro, Docusaurus — basically any GFM-compliant renderer.
This converter walks the DOM produced by the browser's native DOMParser, extracts rows from thead as headers, and pulls alignment from either the legacy align attribute or the inline text-align style. Merged cells (colspan / rowspan) are expanded into a matrix: the merged content sits in the top-left of its span, the rest of the span is filled with blanks, and an orange banner warns you that Markdown cannot represent the merge directly.
Everything runs inside your browser. The HTML you paste never leaves the page.
🧐 Frequently Asked Questions
Q. Will it pick up tables I copy from Excel, Google Sheets, or Numbers?
A. Most spreadsheet apps put both plain text and HTML on the clipboard. Pasting the HTML directly into this tool — or exporting the sheet as HTML first — works in the majority of cases. Some apps wrap the table in extra <meta> and styling tags, but the converter strips those automatically.
Q. What if my table has no <th> cells?
A. The converter inserts an empty header row (| | | |) so the separator line still has columns to align. GFM requires a header row syntactically, but a blank one still renders correctly.
Q. How are inline tags like <a>, <strong>, or <code> handled?
A. In "Strip tags" mode the converter keeps only the cell's text. In "Keep tags" mode it preserves the inline HTML inside the Markdown cell, since GFM lets HTML pass through. Use "Keep tags" when you want to retain links or bold styling; use "Strip tags" for plain-text imports.
Q. What happens to pipe characters (|) inside cells?
A. They are escaped to \| so the table parser doesn't split a cell in two. GFM renderers decode the backslash and display the literal pipe.
Q. Can I paste an entire HTML document with several tables in it? A. Yes. Tables are converted in document order and separated by a blank line in the output. Stats reflect the total rows and the widest column count across all tables.
Q. Does it support <caption> and <colgroup>?
A. Not yet. GFM has no standard way to express a <caption> above a table, and <colgroup> width hints have no Markdown equivalent. Both are skipped silently.
📚 Fun Facts
The pipe-and-dash table syntax used by GFM was originally introduced by PHP Markdown Extra around 2004 — five years before GitHub Flavored Markdown formalized it for README.md. The alignment markers (:---, ---:, :---:) are a near-direct port from Markdown Extra's spec.
One reason the HTML5 parser sometimes confuses people is that browsers will silently move stray content out of a malformed <table> (the so-called "foster parenting" rule). This tool sidesteps that by parsing through DOMParser and walking only the <tr> / <th> / <td> tree, which is the predictable subset that survives a roundtrip through Chrome, Firefox, and Safari alike.