HTML to Markdown Converter

Turn pasted HTML into tidy Markdown with # headings, - bullets and fenced code blocks. Runs in your browser and drops markup Markdown cannot express.

The interactive tool loads here when JavaScript runs.

About this tool

What is the HTML to Markdown Converter?

Paste HTML copied from a page, a CMS export or an email, and get Markdown you can commit to a repository or paste into a wiki. Headings come out in ATX style with hashes, bullet lists use hyphens, links and images keep their targets, and a toggle chooses fenced or indented code blocks.

The conversion is deliberately lossy. Markdown has no spans, no inline styles, no divs and no font tags, so that markup is removed while the text inside it survives. For content migration that is the point: the words and structure come across, the accumulated styling noise does not.

Everything runs on the Turndown library inside your browser. The HTML you paste never leaves the page, and Copy Markdown puts the result on your clipboard when you are done.

  • ATX hash headings and hyphen bullet lists
  • Links and images keep their targets and alt text
  • Fenced or indented code blocks, switchable
  • Markup without a Markdown equivalent is dropped, its text kept
  • Converts in the page; pasted HTML stays on your machine
Read the guide: Unit Conversion Factors: Exact Definitions, Gallons and Temperature Offsets

Updated

How to use the HTML to Markdown Converter

  1. Copy HTML from its source: an editor's HTML view, a template, or an element copied in your browser's developer tools.
  2. Paste it into the left box; the Markdown appears on the right immediately.
  3. Pick fenced or indented code blocks with the toggle if the content includes code.
  4. Scan the result for anything that lost meaning, such as table layouts, and rework those parts by hand.
  5. Click Copy Markdown and paste it into your README, wiki or static site.

Worked examples

A heading

Input

<h2>Install</h2>

Output

## Install

Heading levels map to the number of hashes, h1 through h6, in ATX style.

Inline markup and a link

Input

<p>Use <strong>npm</strong> or <a href="https://example.com">yarn</a>.</p>

Output

Use **npm** or [yarn](https://example.com).

Bold becomes double asterisks, links become bracket-and-parenthesis pairs with their href intact, and <em> would become _underscores_.

A list

Input

<ul><li>First</li><li>Second</li></ul>

Output

- First
- Second

Unordered items get hyphen markers; an <ol> would come out as 1. and 2., and nesting is preserved with indentation.

A code block

Input

<pre><code>npm install</code></pre>

Output

```
npm install
```

With the fence toggle on, the block is wrapped in triple backticks. Switch it off to get the four-space indented form instead.

Background and insight

Markdown is tiny next to HTML. HTML defines well over a hundred elements; Markdown covers roughly a dozen ideas: headings, paragraphs, emphasis, lists, links, images, blockquotes, code and rules. Converting in this direction is therefore a filtering problem, not a translation problem, and the useful question for each tag is which Markdown construct, if any, carries its meaning.

That filtering is why teams convert at all. Years of WYSIWYG editing leave CMS content wrapped in nested divs, empty spans and inline styles that fight every redesign. Passing it through a Markdown converter amounts to a one-way cleanup: what Markdown can say is kept, and what it cannot say was usually presentation rather than content. The result diffs cleanly in version control, which HTML soup never does.

Two style decisions in this tool follow the way most Markdown is written today. Headings use ATX hashes (## Title) rather than setext underlines, because hashes work for all six levels and survive editing better. Bullets use hyphens, the marker CommonMark examples favor. Code can be fenced with backticks, which keeps blank lines inside the block intact, or indented four spaces for older processors.

Common use cases

  • Moving a blog to a static site

    Convert exported post HTML into Markdown files for Hugo, Jekyll, Astro or a docs generator.

  • Quoting a page in a README

    Grab a section of documentation as Markdown instead of retyping its structure.

  • Taming pasted rich text

    Mail and word processor content arrives as tangled HTML; one pass through gives plain, editable text.

  • Feeding notes systems

    Obsidian, wikis and issue trackers all want Markdown, while the web gives you HTML.

Tips and limitations

  • Tables lose their grid: the cell text survives but the rows and pipes do not, because core Markdown has no table syntax. Rebuild important ones with the Markdown Table Generator.
  • Relative links like /docs/setup are kept exactly as written, so they will dangle outside their original site. Make them absolute before converting if the Markdown will live elsewhere.
  • Content hidden by CSS still converts, since only the markup is read. Trim navigation, cookie banners and footers out of the input first.
  • Characters that double as Markdown syntax in the text, such as a literal asterisk, come out escaped with a backslash so they still read as characters.
  • There is no URL fetcher here by design: paste the HTML itself. In a browser, right-click an element in developer tools and choose Copy outerHTML to get exactly the fragment you want.

Sources and further reading

  1. Turndown, GitHub. The HTML to Markdown library this page runs, with its rule options
  2. CommonMark Spec, CommonMark. ATX headings, list markers and the two code block forms
  3. Markdown: Syntax, Daring Fireball. The original description of what Markdown does and does not cover

Frequently asked questions

What happens to HTML that Markdown cannot express?

The tags are removed and their text content is kept. A <span style="color:red">warning</span> becomes just the word warning, because Markdown has no color, no spans and no inline styles. For a content migration this cleanup is usually exactly what you want; anything that must stay styled belongs in your site's CSS, not the text.

How do HTML tables convert to Markdown?

Core Markdown has no tables, so the converter keeps each cell's text but drops the row and column structure. If the table matters, paste its data into the Markdown Table Generator to produce a GFM pipe table, then place that into the converted document.

Why hashes for headings instead of underlined headings?

Markdown has two heading styles. Setext underlines only reach two levels and need a second line, while ATX hashes cover h1 through h6 on a single line, which is why most style guides and linters prefer them. This converter always emits the ATX form.

Can I convert a whole web page by entering its URL?

No. Fetching arbitrary pages would mean routing them through a server, and this tool deliberately has none. Open the page, copy the HTML of the part you need from developer tools or the editor's source view, and paste that. You also get a cleaner result, since you skip headers, menus and scripts.

Should I pick fenced or indented code blocks?

Fenced, unless a legacy processor forces otherwise. Backtick fences preserve blank lines inside the code, can carry a language hint for syntax highlighting, and do not break when someone edits the indentation. Indented blocks are the older CommonMark-compatible fallback.

Do links and images survive the conversion?

Yes. <a href> becomes [text](url) and <img> becomes ![alt](src), with targets and alt text intact. Check relative URLs afterwards, since a link that pointed inside the original site will not resolve from your repository or wiki.

Is there an in-depth guide to the HTML to Markdown Converter?

Yes. “Unit Conversion Factors: Exact Definitions, Gallons and Temperature Offsets” covers the background, how it works, common pitfalls and worked examples. Read the full guide.