HTML to Markdown Converter
Paste your HTML code below and get clean, readable Markdown output. Handles headings, lists, tables, code blocks, links, images, and nested formatting.
Related Tools
How to Use
- Paste Your HTML — Type or paste your HTML code into the input area. The converter accepts any valid HTML including headings, paragraphs, lists, tables, code blocks, links, images, and formatting tags.
- View the Markdown — The converter instantly generates clean Markdown syntax. The Markdown tab shows the raw output, while the Preview tab renders that Markdown with WritePadPro's built-in Markdown renderer so you can check headings, lists, links, and tables at a glance (other Markdown renderers may differ slightly).
- Copy or Download — Click Copy Markdown to copy the output to your clipboard, or Download .md to save it as a Markdown file. The converter also shows size comparison between the HTML input and Markdown output.
About the HTML to Markdown Converter
The HTML to Markdown Converter turns HTML source into Markdown you can keep in a README, a wiki, a static site generator or a notes app. Paste page source, a CMS export or an HTML snippet. You get the Markdown text plus a Preview tab that renders it, so you can check headings, lists and tables before copying. It is mostly used to move content out of a CMS or website into Markdown files.
How the conversion works
Your HTML is parsed with the browser's own DOMParser into an inert document, so scripts in it never run. The converter then walks the element tree:
h1–h6become#to######;strong/bbecome**…**,em/ibecome*…*, anddel/sbecome~~…~~.codebecomes a backtick span. The fence grows when the code itself contains backticks.prebecomes a fenced block, keeping the language from alanguage-orlang-class.- Links become
[text](url "title")and images become. Addresses containing spaces or parentheses are wrapped in<…>. - Lists use
-and1., keep thestartnumber and indent nested lists under their parent item. Checkbox inputs become[x]or[ ]. - Tables become pipe tables. The first row is the header, alignment comes from
alignortext-alignon the header cells, and pipes inside cells are escaped as\|. blockquotebecomes>,hrbecomes---, andbrbecomes a hard line break.subandsupstay as HTML tags because Markdown has no equivalent.script,style,template,iframe,object,embed,noscriptand form elements are removed.
Plain text is escaped where it would otherwise turn into Markdown: *, backticks, brackets and backslashes get a backslash, and < becomes <. Underscores are escaped only at word edges, so my_var stays readable.
Worked example
Input:
<h2>Setup</h2>
<p>Run <code>npm i</code> & read
<a href="https://example.com"
title="Docs">the <b>docs</b></a>.</p>
<ul>
<li>Fast</li>
<li>Private
<ul><li>No uploads</li></ul>
</li>
</ul>
<table>
<tr><th>Plan</th>
<th align="right">Price</th></tr>
<tr><td>A|B</td><td>$5</td></tr>
</table>
<p><span style="font-weight:bold">Big</span>
my_var *star* <u>under</u></p>
<script>alert(1)</script>
Output:
## Setup
Run `npm i` & read [the **docs**](https://example.com "Docs").
- Fast
- Private
- No uploads
| Plan | Price |
| --- | ---: |
| A\|B | $5 |
Big my_var \*star\* under
The script is gone, the nested list is indented and the pipe is escaped. The bold that came from a style attribute is lost, and so is the underline.
Limitations
- Only tags carry formatting. Bold, italic or colors set through CSS or
styleattributes are ignored. Word and Google Docs format text that way, so for those pastes use Rich Text to Markdown, which reads the styles. - Tables: the first row always becomes the header,
colspanandrowspanare not expanded (merged cells shift columns), and lists or paragraphs inside a cell are joined onto one line. - Underline,
markhighlights, definition lists (converted to plain paragraphs), video and embedded frames have no Markdown form and are lost. - Links using
javascript:,data:or other non-web schemes are reduced to their text (http, https, mailto, tel, relative paths and anchors are kept). Images are kept for http, https, relative paths and embedded PNG, GIF, JPEG or WebP data. - Relative links stay relative. If the Markdown will live on a different site, make them absolute.
Practical tips
- Paste only the content element of a web page (often
<article>or<main>). Menus, headers and footers are converted to text, not removed. - Check the Preview tab for tables and nested lists. It uses WritePadPro's renderer, and other renderers may differ slightly.
- If you only need the words without any formatting, Strip HTML Tags is the simpler tool. To turn Markdown back into HTML, use the Markdown to HTML Converter.
Parsing and conversion run inside your browser tab, so the HTML you paste is never uploaded.
Frequently Asked Questions
What HTML tags does this converter handle?
The converter handles all common HTML elements: headings (h1-h6), paragraphs (p), bold (strong, b), italic (em, i), strikethrough (del, s), links (a), images (img), code (code), code blocks (pre > code with language detection), blockquotes, ordered lists (ol), unordered lists (ul) with nested lists indented under their parent item, task lists with checkboxes, tables with alignment (pipe characters inside cells are escaped), horizontal rules (hr), line breaks (br), and nested structures. Script, style, form, and iframe tags are stripped. Links that use javascript:, data:, or similar unsafe addresses are reduced to their text, and images are kept only when their source is http, https, a relative path, or an embedded PNG, GIF, JPEG, or WebP image.
How does it handle complex nested HTML?
The converter uses the browser's built-in DOMParser to create a proper DOM tree from your HTML, then recursively walks the tree converting each node to its Markdown equivalent. This means it correctly handles nested bold inside links, lists inside blockquotes, code inside paragraphs, and other complex structures that regex-based converters often break on.
Will it clean up messy HTML from Word or Google Docs?
Partially. The converter strips script, style, form, and embed tags automatically. It converts formatting tags to Markdown equivalents regardless of how many extra classes or styles they have. However, for heavily formatted Word/Docs content with complex layouts, you may want to use our Rich Text to Markdown tool which is specifically designed for that use case.
Does it preserve code block languages?
Yes. If your HTML code block has a language class like class="language-javascript" or class="language-python" on the code element inside a pre tag, the converter preserves the language hint in the Markdown output as a fenced code block: ```javascript ... ```.
Does this tool send my HTML to a server?
No. All parsing uses the browser's native DOMParser API — your HTML is processed entirely on your device. Nothing is transmitted over the network, stored remotely, or shared with any third party. This makes it safe to convert proprietary code, private documents, and confidential content.