HTML to Markdown

Convert HTML to Markdown online: headings, links, lists, tables, images and code become clean Markdown as you type, right in your browser.

Runs in your browser. Files never leave your device.

About the HTML to Markdown

Convert HTML to Markdown by pasting a snippet or a whole page into the box. Headings h1 to h6, bold, italic, strikethrough, links, images, bulleted and numbered lists (nested too), block quotes, code and tables are rewritten as Markdown, and everything else is reduced to its text. Reach for it when a blog post is moving to a static site, or an HTML fragment needs to become a README section, and you want html to md without installing a converter.

The conversion runs in your browser as you type, so the HTML you paste is not sent anywhere. Scripts, styles, forms and media players are dropped, so a full web page comes out as its readable content.

How the HTML to Markdown conversion works

First the HTML is read into a tree of elements, the way a browser would: attributes in any order, unclosed <p> and <li> tags, comments and character entities such as &amp; and &eacute; are all handled. Then the tree is written out as Markdown, element by element.

Headings become # to ######, strong and b become **bold**, em and i become *italic*, and del or s become ~~strikethrough~~. A link becomes [text](address "title"), keeping its title but ignoring attributes such as class and target. Lists keep their numbering (including a start number), nested lists are indented under their item, and a table becomes a GitHub-style Markdown table with its first row as the header.

Code in a <pre> block becomes a fenced code block with its spacing kept exactly, and a language-js style class becomes the fence's language. Text that Markdown would misread, such as a * or a line starting with #, is escaped with a backslash so it shows as written.

<h2 class="x">Title</h2>   →  ## Title
<strong>word</strong>      →  **word**
<em>word</em>              →  *word*
<a href="URL">text</a>    →  [text](URL)
<img src="a.png" alt="A"> →  ![A](a.png)
<li> in <ol>               →  1. item
<pre><code>…</code></pre>   →  ``` fenced block ```
<br>                       →  two spaces + new line

Assumptions and limits

  • Markdown has no way to show colours, fonts, alignment or layout, so <span>, <u>, <div> and similar tags keep their text but lose their styling.
  • Tables become GitHub-flavoured Markdown tables. Each cell is kept to one line: line breaks inside a cell become <br>, and merged cells (colspan or rowspan) aren't reproduced.
  • A line break (<br>) becomes two spaces at the end of the line, the Markdown way to force a new line. They're easy to miss when you look at the output.
  • Characters that mean something in Markdown, such as *, [, ] and an _ at the start or end of a word, are escaped with a backslash. An underscore inside a word, as in snake_case, is left alone.
  • Scripts, styles, forms, iframes, SVG, video and audio are dropped completely. Images keep their alt text and address; an image without a src is left out.

Worked examples

Convert an HTML heading and paragraph to Markdown

This is the sample that loads with the page. The h1 becomes a level-one heading, the strong tag becomes bold, and a blank line separates the two blocks.

Input:  <h1>Hello</h1><p>This is a <strong>test</strong> paragraph.</p>

Output:
# Hello

This is a **test** paragraph.

HTML list with a link to md

A bulleted list copied from a release-notes page, with a target attribute on the link. Each list item becomes a dash line, the em tag turns into italics and the link keeps its text and address.

Input:
<h2 class="notes">Release notes</h2>
<ul>
<li>Faster <em>export</em></li>
<li>See <a href="https://example.com/docs" target="_blank">the docs</a></li>
</ul>

Output:
## Release notes

- Faster *export*
- See [the docs](https://example.com/docs)

A price table

A two-column table becomes a Markdown table. The pipe inside a cell is escaped so it doesn't start a new column.

Input:
<table><tr><th>Plan</th><th>Price</th></tr><tr><td>Basic | monthly</td><td>$5</td></tr></table>

Output:
| Plan | Price |
| --- | --- |
| Basic \| monthly | $5 |

HTML tags and their Markdown output

What each common tag turns into with this converter. Tags marked 'text kept' lose their formatting only.

HTMLMarkdown result
<h1> to <h6># to ###### heading
<strong> or <b>**bold**
<em> or <i>*italic*
<del> or <s>~~strikethrough~~
<a href="URL">text</a>[text](URL)
<img src="URL" alt="A">![A](URL)
<ul><li>- item
<ol><li>1. item, numbered in order
<blockquote>> quoted lines
<code>`inline code`
<pre>Fenced code block
<table>| Markdown | table |
<hr>---
<span>, <u>, <div>Text kept
<script>, <style>, <form>Removed

How to use the HTML to Markdown

  1. Paste your HTML. Replace the sample in the Input box with a fragment or a whole page; attributes can stay as they are.
  2. Check the Markdown. The Output box fills in straight away; press Process if you want to re-run it after editing.
  3. Copy the result. Use the Copy button above the Output box and paste the Markdown into your editor, README or static site file.

Frequently asked questions

How do I convert HTML to Markdown online?

Paste the HTML into the Input box and the Markdown appears in the Output box straight away. Headings, bold, italic, links, images, lists, quotes, code and tables are converted; other tags keep their text. Copy the result with the Copy button.

Does it keep numbered lists?

Yes. Items in an <ol> are numbered 1., 2., 3. and so on, starting from the list's start number if it has one, and lists inside lists are indented under their parent item. Items in a <ul> start with a dash.

Can it convert tables, images and code blocks to Markdown?

Yes. Tables become GitHub-style Markdown tables, images become ![alt](address), inline <code> becomes `code`, and <pre> blocks become fenced code blocks with their indentation and blank lines kept. Merged table cells are the one thing Markdown can't show.

Why are there backslashes in my Markdown?

They stop Markdown from reading ordinary text as formatting. A line that starts with # would turn into a heading and *stars* would turn into italics, so they're written as \# and \*. Markdown viewers hide the backslash and show the character as you typed it.

Is the HTML to md conversion done on a server?

No. The conversion runs in JavaScript inside your browser tab, so the HTML you paste, including any private draft text or internal links, stays on your device. It also means the tool keeps working if your connection drops after the page has loaded.

This tool runs entirely in your browser. What you enter or upload stays on your device and is never sent to our servers.