HTML to Markdown Converter
Turn HTML into clean Markdown — headings, paragraphs, bold and italic, links, images, nested lists, code, quotes and tables — or plain text; scripts dropped.
Markdown (or plain text) that keeps the document’s structure, with counts of what was converted and what was dropped, ready to paste into a README, a wiki or an editor.
Example: An article with h1, a paragraph with strong/em/code and a titled link, a nested ul, a pre/code block and a table becomes # heading, **bold**, `code`, [link](…), bullets, a fence and a pipe table.
Tags in,
structure out.
How the HTML is read, which element becomes which Markdown, and what is thrown away.
Reading the HTML
A small tag parser written for this page builds an element tree without a browser DOM, so the same code runs in the automated tests. It tolerates real-world markup: unclosed <p> and <li> are closed where the HTML standard would close them, comments and doctypes are skipped, attributes may be quoted or not, and character entities (&, ©, —, named ones like —) are decoded. If the input has a <body>, only its contents are converted.
The mapping
h1–h6 → # headings; p, div and other block containers → paragraphs; br → a two-space line break; strong/b → **bold**; em/i → *italic*; del/s → ~~strike~~; code → `inline code`; pre → a fenced block, with the language taken from a language-x class; a → [text](href "title"); img → ; ul/ol/li → bullets or numbers, nested by indentation and honouring a start attribute; blockquote → > lines; hr → ---; table → a GFM pipe table with the first row as header. Whitespace is collapsed as a browser would, except inside pre. Plain-text mode emits the same structure without the Markdown marks.
Dropped and unwrapped
script, style, head, noscript, template, svg, iframe and object elements are removed and counted. Every other tag the page does not know (span, font, section, custom elements) is unwrapped — its text is kept, its formatting is not. Inline styles, classes and ids are discarded; Markdown has no place for them. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.
SOURCES
- CommonMark Spec 0.31 and GitHub Flavored Markdown Spec — the syntax emitted (ATX headings, fenced code, pipe tables)
- WHATWG HTML Living Standard — element semantics and void elements
Last reviewed 19 September 2026. How results are checked: How we verify.