Skip to content

HTML to Markdown

Convert basic HTML to Markdown.

Input
Output

No result

About HTML to Markdown

This converts HTML markup into Markdown, mapping headings to hash prefixes, bold and italic to asterisks or underscores, list items to leading hyphens, and links to the bracketed target syntax. Any remaining tags are stripped, so the output is clean Markdown rather than HTML with a Markdown veneer.

The use case is moving prose out of a CMS or a rendered page and into a format you can edit in a plain text editor or commit to a repository. Markdown travels well — it is readable as-is, diffs sensibly in version control, and renders anywhere without carrying presentation along with the content.

It covers the common subset — headings through the third level, emphasis, lists, links and line breaks — rather than the whole HTML vocabulary. Structures that have no Markdown equivalent, such as tables with merged cells or nested divs used for layout, lose their formatting and survive only as their text content.

The mapping is deliberately partial and the gaps are worth listing, since each one produces output that looks fine but says less than the source did. Heading levels below the third are stripped of their tags entirely rather than being downgraded, so a document using h4 through h6 comes back with those headings as ordinary paragraphs. No inline HTML is preserved as a fallback, no images are carried across, and block-level structures such as blockquotes, definition lists and fenced code blocks are not recognised. Because every unmatched tag is simply removed, an input that is mostly not in the supported subset returns mostly prose — nothing is lost in terms of words, but a great deal of structure is, and there is no report telling you which elements were dropped.

How to use HTML to Markdown

  1. 1 Paste the HTML markup, either a fragment or a section of a page.
  2. 2 The Markdown equivalent appears immediately, with tags replaced by their Markdown syntax.
  3. 3 Review the headings and lists — unsupported elements are reduced to their text content.

Frequently asked questions

Which HTML elements are supported?

Headings up to the third level, bold and italic text, list items, links, and line breaks. Everything else has its tags removed and its text content kept, so nothing you wrote disappears — it just stops carrying formatting.

Why did my tables come out as plain text?

Because this conversion targets the common prose subset rather than the whole element vocabulary. Table markup has no direct equivalent among the elements it maps, so the cell contents are preserved as text without the table structure.

Do nested lists keep their structure?

Each list item becomes a Markdown bullet, but deeper nesting levels are not given the additional indentation that Markdown uses to express hierarchy. Flat lists convert faithfully; deeply nested ones are better adjusted by hand afterwards.

Can I convert the result back to HTML?

Yes, with the Markdown to HTML tool. Because both conversions handle the same subset of syntax, a document that stays within it round-trips cleanly — anything outside the subset will have been simplified along the way.

Free, online, and private

Free to use

HTML to Markdown is completely free. There is no account to create, no login, and no hidden charge or usage limit.

Runs online in your browser

It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.

Your data stays private

All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.

How HTML to Markdown behaves in detail

These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.

Parameter Value
Strategy a chain of regular expressions over the raw string — no DOM parsing and no HTML parser
Headings converted h1, h2 and h3 only; h4 through h6 have no rule of their own
Inline converted b and strong become **…**, i and em become *…*; <code> is not converted at all
Links only `<a href="…">` with href as the first attribute and double quotes
List items every <li> becomes "- " plus its text, whether it came from a ul or an ol
Leftover tags any tag no earlier rule matched is deleted by a final catch-all that keeps the text between tags

Compiled from the implementation of this tool and checked against it by itoolnet.

What HTML to Markdown does not do

Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.

  • Headings stop at h3. A <h4>Four</h4> heading matches none of the heading rules and falls through to the catch-all tag stripper, so the text survives but the level is lost and the line reads as a plain paragraph.
  • The link rule requires the literal sequence "<a href=", so a tag with any attribute before href — <a class="x" href="u">t</a> — is not recognised, the whole tag is stripped by the catch-all, and the URL disappears from the output entirely.
  • Images are deleted together with their source. An <img src="a.png" alt="x"> matches no rule, so the catch-all removes the tag and neither a markdown image nor the alt text is produced.
  • No newline is inserted around block elements other than li, so a paragraph followed by a list is glued together: "<p>Hello <b>w</b></p><ul><li>i</li></ul>" comes out as "Hello **w**- i".
  • Tables, code blocks, blockquotes and nested lists have no rule of their own, so whatever the catch-all does not strip is left as literal text rather than being converted to markdown syntax.

Tested and documented by itoolnet, the team that builds and maintains this site.

Share & embed this tool

Writing a guide or article? You are welcome to link to HTML to Markdown with the snippet below. It is free, runs entirely in your browser, and needs no signup.