HTML → Markdown Converter
Convert HTML to clean Markdown. Preserves headings, links, lists, code blocks, and inline emphasis.
About HTML → Markdown Converter
This converter walks an HTML document and emits the equivalent Markdown using the turndown library. Standard semantic elements — h1–h6, p, a, strong, em, ul, ol, li, blockquote, pre, code — translate cleanly to their Markdown counterparts. Elements that have no Markdown equivalent (custom tags, divs with styling) are passed through as raw HTML, which is valid Markdown.
When to use it
- Migrating content from a CMS that exports HTML into a static-site generator that wants Markdown
- Pulling rich text out of an email or document into a notes app
- Cleaning up HTML scraped from a webpage into a readable text form
- Round-tripping content through Markdown to strip styling and inline classes
How it works
The HTML is parsed into a DOM tree and walked element by element. Each known tag is mapped to its Markdown form (h1 → '# ', em → '_..._', ul → '- ...'). Unknown elements are preserved as raw HTML. Whitespace inside <pre><code> blocks is preserved exactly; everywhere else it's collapsed.
Examples
<h1>Hello</h1> <p>This is <strong>bold</strong> and <a href="/x">a link</a>.</p> <ul> <li>one</li> <li>two</li> </ul>
Hello ===== This is **bold** and [a link](/x). * one * two
Frequently asked questions
- Does it preserve HTML attributes like classes?
- No. CSS classes, inline styles, and most attributes are dropped — Markdown has no concept of them. Links keep their href, images keep their src and alt, and code blocks keep their language hint when expressible.
- What happens to elements with no Markdown equivalent?
- They are passed through as raw HTML, which is valid inside Markdown documents. <iframe>, <video>, <details>, and custom components survive the round-trip.
- Are tables converted?
- Yes. HTML tables are emitted as GitHub-flavored Markdown tables. Cells containing block-level content (lists, multiple paragraphs) fall back to raw HTML because Markdown tables only support inline content.
- Is content sent to a server?
- No. The conversion runs in your browser via the turndown library.