HTML to Markdown
Free web tool: HTML to Markdown
About HTML to Markdown
The HTML to Markdown Converter transforms HTML markup into clean, readable Markdown syntax entirely within your browser. The conversion engine uses a series of regular expression replacements to handle all common HTML elements: h1 through h6 become # headings, strong and b become **bold**, em and i become *italic*, del and s become ~~strikethrough~~, pre/code blocks become fenced code blocks with triple backticks, anchor tags become [text](url) links, img tags become  image syntax, ul/ol/li become - list items, blockquotes become > quoted lines, and p/div/br tags are converted to proper line breaks and paragraph spacing.
Developers, technical writers, bloggers, and documentation authors frequently use this tool when migrating content from HTML-based CMS systems (like WordPress or Confluence) to Markdown-based platforms (like GitHub, GitLab, Notion, Obsidian, or static site generators). It is also useful for stripping HTML from rich text editor output, converting email templates to documentation drafts, and preparing content for static site generators like Jekyll, Hugo, or Next.js.
The tool runs entirely client-side — your HTML is never sent to any server. It includes a sample HTML document pre-loaded in the input field so you can immediately see how the conversion works. The converted Markdown can be copied to the clipboard with a single click. HTML entity decoding is also handled, converting &, <, >, ", ', and to their plain text equivalents.
Key Features
- Converts h1-h6 headings to # through ###### Markdown heading syntax
- Transforms strong/b to **bold** and em/i to *italic* inline formatting
- Converts pre/code blocks to fenced ``` code blocks with proper entity decoding
- Handles anchor tags as [text](url) and img tags as  Markdown syntax
- Converts ul/ol/li lists to - bullet points preserving list structure
- Transforms blockquote elements to > quoted lines, preserving multi-line quotes
- Decodes HTML entities: &, <, >, ", ', and
- One-click copy to clipboard, preloaded sample HTML, 100% client-side processing
Frequently Asked Questions
What HTML elements are supported in the conversion?
The converter handles: headings (h1-h6), bold (strong, b), italic (em, i), strikethrough (del, s), inline code (code), code blocks (pre, pre/code), links (a href), images (img src/alt), unordered and ordered lists (ul, ol, li), blockquotes, horizontal rules (hr), line breaks (br), paragraphs (p), divs, and spans. HTML attributes other than href, src, and alt are stripped.
Does the converter handle nested HTML elements?
The converter uses sequential regex replacements, which works well for most common HTML patterns. Deeply nested or complex structures may not convert perfectly. For example, nested lists may lose their indentation structure. For complex documents, a dedicated library like Turndown.js may produce better results.
How are code blocks handled differently from inline code?
Inline code (wrapped in a single code tag without a pre parent) is converted to `backtick` syntax. Code blocks (pre tags, or pre containing a code tag) are converted to triple-backtick fenced code blocks. HTML entities inside code blocks are decoded back to their original characters (<, >, &) before being wrapped in the fence.
What happens to HTML attributes like class, id, and style?
The converter extracts only the semantically meaningful attributes: href from anchor tags, and src and alt from image tags. All other attributes (class, id, style, data-*, etc.) are discarded. The output Markdown only contains the content and structure, not presentation information.
Can I use this to convert WordPress or CMS content to Markdown?
Yes. This tool is well-suited for converting HTML content from WordPress, Confluence, Notion, or any CMS that exports HTML. Paste the HTML source of a page or post into the input field, and the converter will produce Markdown that can be used in GitHub README files, static site generators, or Markdown-based editors.
Does the tool preserve line breaks within paragraphs?
The converter converts br tags to newlines and p tags to double newlines (paragraph breaks). Multiple consecutive newlines are collapsed to a maximum of two. Inline whitespace within text is preserved as-is. The output is cleaned up so there are no more than two consecutive blank lines.
Why is the Markdown output sometimes wider than expected?
Markdown does not have strict line-length requirements, unlike some other markup languages. The converter preserves the natural flow of text from the original HTML. If you need to wrap long lines, you can paste the Markdown output into an editor that supports auto-wrap or use a Markdown formatter.
Is there any limit on the size of HTML I can convert?
There is no explicit size limit imposed by this tool. Since conversion happens in your browser using JavaScript regex operations, very large HTML documents may take a moment to process. The tool works best for typical web page content, blog posts, and documentation pages rather than entire website exports.