HTML to Markdown Converter

Convert HTML to GitHub Flavored Markdown: headings, emphasis, links (inline or reference style), images, nested and numbered lists, task lists, fenced code with its language, block quotes and tables. Scripts and styles are dropped, and every dropped element is listed with the reason.

Converter Web & Dev Updated Oct 4, 2026
Learn how this works
How to Use
  1. Paste HTML into the box, drop an .html file on it, or use Open file. A preset loads an example.
  2. Choose the heading style (ATX # or setext underlines) and the link style (inline or reference).
  3. Choose what happens to tags Markdown has no form for, such as or <details>: keep only their text, or keep them as raw HTML.
  4. Check the Markdown against the rendered preview beside it; both update as you type.
  5. Read Show Work for the count of each element converted and everything dropped, with the reason, then Copy or Download the .md file.
HTML
paste or drop a file
.html up to 5 MB, read in your browser
Presets
Markdown / Preview
Markdown
Rendered
Converted
—
Dropped
—
Links
Markdown size
—

Worked Example

Convert this HTML (215 bytes):

<h2>Install</h2>
<p>Run <code>npm i tidy</code>, then read the <a href="https://example.com/docs">docs</a>.</p>
<ul>
  <li>Fast</li>
  <li><b>Tiny</b> &amp; no <i>dependencies</i></li>
</ul>
<script>track()</script>

The <h2> becomes ## Install. In the paragraph, <code> becomes a backtick span and the link becomes [docs](https://example.com/docs). Each <li> becomes a - item, with <b> as **Tiny** and <i> as *dependencies*; the entity &amp; is just an &. The <script> is dropped and listed in Show Work. Result, 116 bytes:

## Install

Run `npm i tidy`, then read the [docs](https://example.com/docs).

- Fast
- **Tiny** & no *dependencies*

The common mistake: converting text that already looks like Markdown without escaping it. <p>1986. A great year for 5 * 3 = 15 fans</p> copied across as-is renders as a numbered list item starting at 1986, with the text after the * in italics if another asterisk follows. Written as 1986\. A great year for 5 \* 3 = 15 fans — as this tool does — it stays an ordinary sentence.

Show Work

Paste some HTML above to see what each element became.

Conversion Reference

Headings
<h2>Title</h2> → ## Title
Setext underlines h1 with === and h2 with ---; h3–h6 always use #
Emphasis
<b> → **x**   <i> → *x*   <del> → ~~x~~
Spaces inside the tag move outside the markers
Links and images
[text](url "title")   ![alt](src)
Reference style: [text][1] with [1]: url at the end
Lists
- item   7. item   - [x] task
Nested lists indent by the marker’s width; <ol start> is kept
Code
`inline`   ```lang … ```
Language from class="language-x"; fences grow past any ``` inside
Tables
| a | b | then | :-- | --: |
align / text-align on header cells; | in a cell becomes \|
Line break
<br> → \ at the end of the line
A backslash break survives editors that strip trailing spaces
Dropped
script style iframe svg comments on…
Counted in Show Work with the reason for each

Why HTML and Markdown Do Not Map One to One

John Gruber designed Markdown in 2004 as a way to write HTML, not to replace it: anything Markdown could not express was meant to be written as HTML inside the Markdown. So the conversion only runs cleanly in one direction. Every Markdown construct has an HTML form, but HTML has dozens of elements — superscripts, definition lists, forms, merged table cells, colours — with no Markdown form at all.

A converter therefore has to choose for each of those: keep the text and lose the markup, or keep the HTML and accept that some renderers will escape it or strip it (GitHub keeps <sup> and <details>, for example, but removes scripts and styles). This tool lets you make that choice and lists every element it dropped. Tables, task lists and strikethrough come from GitHub Flavored Markdown, specified in 2017 on top of CommonMark.

About This Tool

This tool converts HTML to GitHub Flavored Markdown: ATX or setext headings, bold, italic and strikethrough, inline or reference-style links, images, nested bullet and numbered lists (keeping a start number), task lists, inline code and fenced code with the language from its class, block quotes, tables with alignment, rules and line breaks. Text that Markdown would misread is escaped, and elements with no Markdown form keep their text or stay as raw HTML, as you choose.

The HTML is parsed with DOMParser into a detached document, so nothing in it runs or loads, and the preview is drawn from the Markdown by the same safe renderer as the Markdown to HTML tool, with images shown as labelled boxes rather than fetched. Show Work counts every element converted and lists everything dropped, with the reason. Everything runs in your browser.

Related tools: Markdown to HTML Converter, HTML, CSS & JS Minifier, and HTML Entity Encoder.

Frequently Asked Questions

Is it safe to paste HTML from any website?

Yes. The HTML is parsed with the browser’s DOMParser into a separate document that has no window: its scripts do not run, its images do not load and nothing from it is added to this page. Script, style, iframe and similar elements are dropped, links with javascript: addresses keep only their text, and the preview is drawn from the Markdown by a renderer that escapes raw HTML.

Why are some characters in the Markdown preceded by a backslash?

Because Markdown would otherwise read them as formatting. A paragraph that starts “1986. A great year” would become a numbered list starting at 1986, so it is written 1986\. A great year; 5 * 3 becomes 5 \* 3 so the asterisk is not taken as emphasis. The backslashes disappear when the Markdown is rendered.

What happens to tables?

They become GitHub tables. The first row is the header (if the HTML has no header row, the first row is used anyway and Show Work says so), align or text-align on the header cells sets the :-: and --: alignment, a | in a cell is escaped as \|, and merged cells are split, because Markdown tables cannot span.

How is the code block language detected?

From a language- or lang- class on the <pre> or its , the convention used by highlight.js, Prism and most Markdown renderers. <pre><code class="language-js"> becomes a fence opening with ```js. If the code itself contains three backticks, the fence is made one backtick longer so it cannot close early.

What is the difference between inline and reference links?

Inline links keep the address next to the text: [docs](https://example.com/docs). Reference links put a number in the text, [docs][1], and list every address once at the end as [1]: https://example.com/docs, which keeps long paragraphs readable. The same address used twice gets the same number.

How do I use the HTML to Markdown Converter?

Just type or paste your value. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Moving a blog to a static site

Paste a post’s HTML from the old CMS and get Markdown with headings, images and links ready for Hugo, Jekyll or Astro.

Cleaning up a word-processor paste

HTML full of spans, fonts and empty paragraphs comes out as plain paragraphs, bold and italic, with the clutter counted in Show Work.

Writing a README from docs

Turn an HTML documentation page into GitHub Markdown, keeping code blocks with their language and tables with their alignment.

Notes and wikis

Save a web article as Markdown for Obsidian or a Git-based wiki, with reference-style links so the text stays readable.

Checking what a page really contains

The dropped list shows every script, iframe, comment and event handler in a pasted snippet, with how many of each.

Last updated: