HTML to Markdown Converter
Paste raw HTML or rich text copied from a webpage, Google Doc, or Word document and instantly get clean, readable Markdown. Supports tables, code blocks, nested lists, images, and a live rendered preview — all client-side.
HTML → Markdown Converter
Paste HTML or rich text — get clean, readable Markdown instantly
How to convert HTML to Markdown
Paste your HTML into the left panel (use the Raw HTML mode for source code, or Rich Paste mode to paste directly from a browser). Click Convert to Markdown. The right panel shows clean markdown output with a word and line count. Switch to Preview mode to see the rendered result. Toggle options for tables, images, code blocks, strikethrough, and HTML comment stripping.
Copy a blog post from your browser, paste it into the Rich Paste panel, and convert it to clean markdown for your documentation wiki. A 2,000-word article converts in under a second. Tables, code blocks, and nested lists are preserved with proper markdown syntax.
Forward an HTML email newsletter to yourself, copy the source, paste it into Raw HTML mode, and convert. The tool strips tracking pixels, removes style blocks, and preserves the actual content structure -- headings, paragraphs, links, and images -- in clean markdown format.
Export content from WordPress, Squarespace, or Webflow as HTML, paste it in bulk, and convert to markdown for migration to Hugo, Jekyll, or Astro. The tool handles nested divs, figure elements, and responsive image tags by extracting the semantic content and discarding presentation markup.
HTML to Markdown conversion pipeline
The tool parses your HTML into a browser DOM tree using the native DOMParser API, then recursively walks every node to produce equivalent markdown. Script and style elements are stripped before processing. The converter handles malformed HTML gracefully -- unclosed tags, missing body elements, and nested divs all get parsed into a valid DOM.
DOM tree traversal
Each HTML element is mapped to its markdown equivalent: h1-h6 become # through ######, strong/b become **bold**, em/i become *italic*, a elements become [text](url), and img elements become . The converter processes children before parents so nested formatting renders correctly. A bold-italic sequence produces ***bold italic***.
Table conversion
HTML tables are converted to pipe tables with header separators. The converter extracts all th and td cells, joins them with pipe characters, and generates a separator row of --- dashes. Tables with colspan or rowspan attributes are simplified to a flat grid. A 5-column, 10-row table converts to 12 lines of pipe-table markdown.
Code block detection
The converter detects both fenced code blocks (pre > code with a language-* class) and indented code blocks (pre without code child). Fenced blocks preserve the language tag for syntax highlighting. Inline code (code not inside pre) is wrapped in single backticks. The Strip Comments option removes HTML comments before conversion.
Output cleanup
After conversion, the output is cleaned: consecutive blank lines are collapsed to a single blank line, leading and trailing blank lines are removed, and markdown special characters in text nodes are escaped with backslashes. The result is CommonMark-compliant markdown that renders correctly in GitHub, Obsidian, Notion, and most static site generators.
Frequently asked questions
Does it preserve all HTML content?
Text content, links, images, lists, and code blocks are preserved exactly. Presentation elements like divs, spans with inline styles, and table layout markup are converted to semantic markdown or removed. The tool strips script tags, style blocks, and HTML comments (unless you disable that option). A 500-word HTML document typically converts to 400-450 words of markdown after presentation markup is removed.
How do I paste rich text from a webpage?
Click the Rich Paste button to switch to contenteditable mode, then paste with Ctrl+V (or Cmd+V on Mac). The tool captures the HTML portion of the clipboard data, preserving formatting. If the source page uses complex CSS-only styling (no semantic HTML), some formatting may be lost. For best results, use the Raw HTML mode with the page source.
How does it handle complex tables?
Standard HTML tables with th and td cells convert cleanly to pipe tables. Tables with colspan or rowspan attributes are simplified -- merged cells are flattened and the colspan/rowspan content is placed in the first cell. Very complex tables with 3+ levels of nesting or mixed header orientations may lose some structure. For those cases, the plain-text fallback preserves the cell content.
Is the output valid markdown?
Yes. The output follows CommonMark specification and is compatible with GitHub, GitLab, Obsidian, Notion, Hugo, Jekyll, and Astro. Edge cases like deeply nested lists (6+ levels) or tables with 20+ columns may need manual review for optimal rendering in some parsers. The preview mode lets you verify the output before copying.