Skip to content
Convert Filez
Developer ToolsRuns in your browser6 min readUpdated July 29, 2026

HTML to Markdown Converter

This html to markdown converter takes real HTML, copied from a rendered web page, exported from a rich text editor, or pulled out of a CMS, and turns it into clean Markdown you can paste into a README, a static site or a note taking app. Paste markup and the Markdown equivalent appears immediately, generated entirely inside your browser.

Loading the tool interface
Files never leave your deviceNo upload wait and no queueNo signup, watermark or file limit

Going from HTML to Markdown is a different problem than the reverse direction. HTML allows far more structure and far more ways to express the same visual result, several different tags for emphasis, deeply nested formatting spans, inline styles carrying information no Markdown syntax can represent, so converting well means walking the actual document structure and deciding what to keep rather than running a handful of substitutions over raw text.

Nothing is uploaded. The HTML you paste is parsed using the browser's own DOMParser, and the resulting tree is walked entirely on your device to build the Markdown output, which matters when the source is proprietary content, an unpublished draft, or a client's page you have no business sending to a third party server. The same walk is what lets this tool strip html to markdown cleanly rather than leaving behind leftover tags a plain text copy would keep.

Why this html to markdown converter uses DOMParser rather than regex

HTML is not a format regular expressions can parse reliably, because tags nest arbitrarily deep, attributes can contain characters that look like tag boundaries, and a single malformed or unclosed tag anywhere in a document changes how every tag after it should be interpreted. A regular expression matches patterns without understanding structure, so it has no way to know that a bold tag closed three levels up rather than one.

This tool hands the raw HTML to the browser's own DOMParser, the same engine that parses every page you visit, and then walks the resulting tree node by node. That means malformed markup is handled exactly the way a browser already handles it when rendering a real page, rather than however a bespoke parser happens to guess, and nesting, however deep, is tracked correctly because the DOM itself already represents it as a tree.

  • Headings h1 through h6 convert to the matching number of hash characters.
  • Bold, strong, italic and em all convert to standard Markdown emphasis syntax.
  • Anchor tags convert to [text](url), and img tags convert to ![alt](src).
  • Ordered and unordered lists convert to numbered lines or hyphen prefixed lines.
  • Pre and code elements convert to fenced or inline code respectively.

How this tool walks the DOM to convert html to markdown

Conversion works as a recursive walk starting at the parsed document's body element. Each node is inspected by its tag name, and a matching Markdown fragment is produced, then the function recurses into that node's children to build up the inner content before wrapping it with the outer syntax, so a bold span containing a link produces correctly ordered Markdown, the link syntax nested inside the bold markers rather than the two colliding.

Plain text nodes are passed through as their literal text content, which is exactly what a browser's own textContent property already gives you, whitespace collapsed the same way the DOM itself collapses it during parsing. This is what keeps stray formatting artifacts, extra tags left over from a copy and paste out of a word processor, from leaking into the output as visible junk.

What gets dropped when you convert html to md

Markdown has no equivalent for a great deal of what HTML can express: inline styles, custom data attributes, script and style elements, table cell alignment beyond the basic pipe syntax, and semantic elements like article or section that carry no visual meaning of their own. This converter drops attributes and elements that have no Markdown equivalent rather than trying to fake one with an awkward workaround, since a fabricated substitute is usually more confusing than simply omitting it.

Script and style tags are removed entirely rather than converted, since their content is code or styling information, not document content, and including it as visible text in the Markdown output would be actively wrong rather than merely incomplete.

Converting copied content with an html to markdown online workflow

The most common real use case is copying a block of formatted text out of a web page, a Google Doc, or a rich text editor, where the clipboard actually carries HTML behind the scenes even though what you see is plain looking text. Pasting that HTML into an html to markdown online tool like this one recovers the actual structure, headings, bold, links, that a plain paste into a Markdown file would otherwise lose entirely, leaving you with an unformatted wall of text.

This is also useful in the opposite direction from migration: pulling content out of an old CMS export, which is usually HTML, into a Markdown based static site generator, where hand reformatting hundreds of articles is not realistic and an automated conversion pass is the only practical option.

Cleaning up the result before you commit it

Generated Markdown from real world HTML, especially HTML copied out of a word processor or a page with heavy inline styling, often benefits from a quick read through afterward. Look for emphasis that seems to appear in an unexpected place, which usually traces back to a span the original author added purely for a colour or font change rather than genuine emphasis, something Markdown correctly has no way to represent.

Once the structure looks right, save the file with a .md extension and it is ready for a static site generator, a documentation repository, or any editor that renders Markdown. Because the conversion strips presentational cruft rather than trying to preserve it, the result is usually noticeably shorter and easier to hand edit than the original HTML source.

How this converter maps HTML elements to Markdown
HTML elementMarkdown output
h1 to h6# through ###### heading
strong, b**bold text**
em, i*italic text*
a[text](url)
img![alt](src)
ul, ol, lihyphen or numbered list lines
pre, codefenced or inline code
blockquote> quoted line

How to convert HTML to Markdown

  1. 1

    Paste your HTML

    Add HTML markup into the input box, copied from a page, an editor, or an exported document.

  2. 2

    Convert to Markdown

    Press convert. The HTML is parsed with DOMParser and walked locally to build Markdown output.

  3. 3

    Review the result

    Check that headings, links and lists carried over the way you expected, and adjust the source HTML if not.

  4. 4

    Copy or download

    Copy the Markdown to your clipboard or download it as a .md file ready to commit.

Related tools worth bookmarking

Sources and further reading

Frequently asked questions

Common questions about the html to markdown converter.

Yes, because it hands the markup to the browser's own DOMParser rather than a hand rolled regular expression. That parser is the same engine used to render real web pages, so unclosed tags and other malformed markup are handled the same forgiving way a browser already handles them when displaying a page.

They are dropped, since Markdown has no syntax to represent a custom colour, font or class name. Only structural and semantic meaning, headings, emphasis, links, lists and code, carries across, which usually produces cleaner and more portable output than trying to preserve presentation that will not survive in Markdown anyway.

Yes, though the output focuses on content rather than layout. Elements with no Markdown equivalent, such as navigation bars, script tags and style blocks, are omitted, so the result reads as the article content rather than a full reproduction of the original page's visual structure.

No. DOMParser builds the tree locally and the recursive walk that produces Markdown reads straight from it in memory, inside the tab. A client's unpublished page can be converted without the tree, or the HTML it came from, ever being serialised into a network request.

Yes. The conversion walks the DOM recursively, so a link nested inside a bold span, or a bold span nested inside a list item, produces correctly ordered Markdown with the inner syntax nested inside the outer syntax exactly as the HTML structure specified.

Markdown intentionally represents structure and meaning rather than exact visual presentation, so a page relying heavily on custom fonts, colours or spacing for its look will lose those specific details in the conversion. What carries over is the semantic content, headings, emphasis, links and lists, which is what Markdown is designed to express.

Keep going

More developer tools

View the full category