HTML to Markdown
Parses the real DOM rather than running regexes — nested lists, tables and code blocks all survive.
How to Use
- 1. Paste your HTML, or drop an .html file onto the page.
- 2. Choose your bullet, heading and emphasis style.
- 3. Decide whether tables become Markdown pipe tables or stay as HTML.
- 4. Copy or download the Markdown.
Converting Markup Without Losing Content
This converter parses the HTML into a real DOM and walks it, rather than running regular expressions over the source. That distinction matters more than it sounds: regex converters break on nested lists, on attributes containing angle brackets, and on any markup that is slightly malformed. The browser's own parser already handles all of that, including tags you forgot to close, so the walk starts from a correct tree.
Markdown cannot express everything HTML can, and being honest about that is most of the work. Inline styles, classes, custom attributes, scripts and iframes have no equivalent, so they are dropped and their text content kept. Tables with rowspan or colspan also have no Markdown form — those are left as raw HTML rather than silently flattened into a grid that misrepresents the data.
Escaping is the subtler half. Text containing an asterisk, an underscore or a leading hash would be read as syntax if emitted as-is, so those are escaped — snake_case survives as snake\_case rather than turning half a sentence italic. Inline code containing backticks gets a longer fence, following the CommonMark rule, so it still renders as code.
One small detail with an outsized effect on output quality: whitespace between block elements is source formatting, not content. Treating it as a space is what leaves stray blank lines with a single space on them throughout the result, so indentation newlines and whitespace touching a block element are discarded.
Related: Markdown to HTML, Strip HTML Tags, and Markdown Table Generator.
Frequently Asked Questions
Why convert HTML to Markdown?
Usually to get content out of one system and into another. Pasting a rendered article into a Markdown-based CMS, a static site generator, a README or a documentation tool means converting the markup first. Markdown is also far easier to diff and review in version control than HTML.
What happens to markup Markdown cannot express?
Markdown has no equivalent for most styling, so inline styles, classes, custom attributes, scripts and iframes are dropped. Where Markdown does allow raw HTML — tables, for instance, if you turn the table option off — the original tags are kept instead.
Does it handle tables?
Yes, simple ones. Rectangular tables become GitHub-flavoured Markdown pipe tables. Tables using rowspan or colspan have no Markdown representation at all, so those are left as HTML rather than silently flattened into something wrong.
What are reference links?
Instead of putting each URL inline, reference style puts a short label in the text and collects all the URLs at the bottom. It keeps paragraphs readable when they contain several long links, which matters when a human will edit the Markdown afterwards.
Is this the reverse of your Markdown to HTML tool?
Yes, for anything Markdown can represent. A round trip through both tools returns equivalent content, though not always byte-identical formatting — whitespace and the choice of emphasis characters may differ.
Was this tool helpful?
More Tools
Related Developer Tools
JS & CSS Minifier
JSON Formatter
Regex Tester
SQL Formatter
You Might Also Like