Skip to content
AZ Tools

HTML → Markdown Converter

Convert HTML to clean Markdown — headings, lists, links, tables, code blocks all preserved. Useful for migrating CMS content or scraping articles.

Markdown
Paste HTML on the left.

Conversion runs entirely in your browser via DOMParser. No data leaves the page.

How to use

  1. Paste HTML (a fragment is fine — no need for <html> / <body>).
  2. Choose your bullet style and whether to keep links and images.
  3. Copy the Markdown output.

About this tool

Show

Paste HTML (a fragment or full page) and get GitHub-flavored Markdown. The converter walks the DOM and emits proper Markdown for every common tag: <h1>–<h6>, <p>, <strong>, <em>, <a>, <img>, <ul> / <ol> (nested supported), <table>, <blockquote>, <pre><code> with language detection, <hr>, <br>. Scripts and styles are stripped. Useful for converting CMS exports, blog posts, or copied web pages into Markdown.

The conversion is lossy in one direction by design, because Markdown is a much smaller language than HTML. Classes, ids, inline styles, data attributes and anything positional have no Markdown equivalent and are dropped rather than approximated. That is usually the point when the goal is to get content out of a CMS, and it is a problem when the markup was carrying meaning in its attributes.

Tables are where the limit shows first. GitHub-flavored Markdown tables are strictly rectangular, so a cell spanning two columns or two rows cannot be expressed, and neither can a table containing a list or a second table. HTML from a real page frequently has all three, and the honest output for those is HTML left as-is, since Markdown permits raw HTML where it has no syntax of its own.

Walking the DOM rather than matching patterns is what makes the output trustworthy on messy input. A browser's parser repairs unclosed tags, implied elements and mis-nesting the same way it would when rendering, so the structure the converter sees is the structure a reader sees. A regex-based converter reads the text instead, and unbalanced markup is exactly where the two disagree.

Characters that mean something in Markdown need escaping on the way out. An underscore inside a word, a line beginning with a digit and a period, a leading hash: each is ordinary text in HTML and a formatting instruction in Markdown, so a faithful conversion has to neutralise them rather than pass them through.

Frequently asked questions

What about non-standard tags or attributes?

Unknown inline tags pass through as their inner text. Unknown block tags become paragraphs. Style/class/data-* attributes are dropped — Markdown can't represent them anyway.

Does it preserve code-block language?

Yes — if the <code> element has a class like language-js or language-python, the fence is annotated with that language.

Tables not converting correctly?

Markdown tables can't represent merged cells (colspan/rowspan) or nested blocks within cells. Complex tables get flattened — sometimes you'll need manual cleanup.

Why does pasting from Word produce weird output?

Word's HTML export is famously bloated with mso-* styles and proprietary tags. Paste into a plain <textarea> first or use a Word→Markdown specific tool for cleaner output.

Related tools