HTML to Markdown

Nothing you choose here leaves your browser, and nothing is downloaded to make it work — no parser, no library, nothing. You can also paste instead of choosing a file.

…or drop a file anywhere on this page.

A .htm is the same file as a .html — the short extension is a leftover from MS-DOS, which allowed only three characters after the dot. This page takes either. More about that.

A reduction, and it is worth being honest about which way that runs.

Markdown cannot express most of HTML, so this keeps what people write by hand — headings, paragraphs, emphasis, lists, quotes, code, links, images, tables and rules — and drops the rest. Styling, classes, forms and scripts are gone. The test that matters is not whether the Markdown looks like somebody else's Markdown, because there are many correct spellings of the same document; it is whether it means the same thing, and that is what is checked.

Which Markdown, exactly

There is no single Markdown, and a converter that does not say which one it speaks has told you nothing. There is the original 2004 script, CommonMark (which pinned down what the original left ambiguous), GitHub Flavored Markdown — CommonMark plus a few additions — and a dozen dialects beyond that. The same file genuinely produces different documents in different tools.

This reads CommonMark, plus the three GFM additions people actually use: tables, strikethrough and task lists. So: headings both ways round, emphasis and strong, code spans and fenced code with a language, links and reference links, images, autolinks, ordered and unordered lists nested to any depth, tight and loose lists, blockquotes, thematic breaks, hard line breaks and backslash escapes.

It does not read footnotes, definition lists, citations, maths, or the attribute and directive syntaxes that particular tools add. Those come through as the characters you typed, rather than disappearing without a word.

Raw HTML is shown, not run — on purpose

CommonMark lets you write HTML inside Markdown and passes it straight through. This escapes it and shows it as text. That is a deliberate difference and not an oversight: what this page hands back is a file you download and open in a browser, and a converter that quietly carried a <script> out of somebody's document and into that file would not be doing you a favour. If you want the HTML rendered, the document you want is HTML, not Markdown.

How it is checked

Against pandoc, which is the reference implementation most people would reach for and was written by other people over fifteen years. A document covering every construct listed above goes through both, and the two outputs are compared on the sequence of elements, the words in order, and every link and image address.

Not on the HTML text itself, which would be a test of formatting: two correct implementations disagree about whitespace and about attributes that carry no meaning. A comparison that goes red for reasons nobody can act on is a comparison people stop reading.

What it will not do

It will not preserve anything Markdown cannot say, and that is most of HTML: classes, styles, forms, scripts, anything positioned, and any element with no Markdown equivalent. Those are counted and the number is reported rather than passed over.

It does not fetch anything your document refers to. A picture at a web address stays a reference to that address, because going to get it would mean this page contacting another site — the one thing it promises never to do. And it is not a linter: it converts what you wrote rather than telling you what you should have written.

Where to go next