HTML to Markdown Converter

Paste HTML source or upload an .html file. Headings, links, code blocks and header-row tables come out as GitHub-flavored Markdown.

Input — HTML
Output — Markdown
Markdown output will appear here...

To convert HTML to Markdown, paste the HTML into the left panel above. The Markdown appears on the right as you type, and you can copy it or download a .md file. Under the hood it is Turndown with the GitHub-flavored Markdown plugin: headings become # lines, <pre><code> becomes a fenced block, and tables with a header row become pipe tables.

What does the output look like?

Heading, inline code, link and emphasis

HTML in
<h2>Install</h2>
<p>Run <code>npm ci</code>, then read the <a href="https://example.com/setup">setup notes</a>. It takes <strong>two minutes</strong> on a <em>clean</em> checkout.</p>
Markdown out
## Install

Run `npm ci`, then read the [setup notes](https://example.com/setup). It takes **two minutes** on a _clean_ checkout.

A table with a header row and a code block

HTML in
<table>
  <thead><tr><th>Plan</th><th>Seats</th></tr></thead>
  <tbody>
    <tr><td>Free</td><td>1</td></tr>
    <tr><td>Team</td><td>10</td></tr>
  </tbody>
</table>
<pre><code class="language-js">const seats = plan.seats ?? 1;</code></pre>
Markdown out
| Plan | Seats |
| --- | --- |
| Free | 1 |
| Team | 10 |

```js
const seats = plan.seats ?? 1;
```

Nested list, checkbox, strikethrough and an image

HTML in
<ul>
  <li>Backend<ul><li>Move to Postgres 17</li></ul></li>
  <li><input type="checkbox" checked> Write the changelog</li>
</ul>
<p><del>Friday</del> Monday 🚀 <img src="/img/chart.png" alt="Weekly chart"></p>
Markdown out
-   Backend
    -   Move to Postgres 17
-   [x]  Write the changelog

~Friday~ Monday 🚀 ![Weekly chart](/img/chart.png)

Why did my table stay as HTML?

A Markdown table needs a header row. If the first row of your <table> has no <th> cells and is not inside <thead>, the converter keeps the whole table as HTML instead of guessing. Most Markdown renderers, GitHub included, still display it.

To get a pipe table, change the first row's <td> tags to <th> and convert again. If the data came from a spreadsheet, the Excel to Markdown or CSV to Markdown tools are a better fit.

Does the code block keep its language?

Yes, if the HTML says what it is. A <pre><code class="language-python"> block becomes a fence tagged python. A bare <pre> with no <code> inside is not fenced: its text and line breaks are kept, but it renders as ordinary text. Wrap it in <code> first.

Should I paste the whole page source or just the article?

Just the part you want. This tool converts everything you give it except scripts and styles, so navigation and footers come through too. Copy the <article> or <main> element from your browser's developer tools, or let URL to Markdown pick out the main content for you. If you are copying from a rendered page rather than source, Paste to Markdown reads the clipboard directly.

How are tables, code, scripts and other HTML edge cases handled?

InputWhat you get
<table> with <th> or <thead> in the first rowGFM pipe table with a | --- | separator row
<table> with no header rowLeft as raw HTML
A | character or a <p> inside a table cellNot escaped or flattened, so the row breaks. Fix those cells by hand
<pre><code class="language-x">Fenced block tagged x
<pre> without <code>Text and line breaks kept, no fence
<script>, <style>, <title>Removed, contents and all
<ul>/<ol> nested lists- or 1. markers, nested items indented four spaces; <ol start> respected
<input type="checkbox"> in a list item[x] or [ ] task marker
<del>, <s>, <strike>~text~ (single tilde)
<img>![alt](src) with the src exactly as written
<br>Two trailing spaces and a line break
<sup>, <sub>, <u>, <mark>, <span>Tag dropped, text kept
HTML comments, <iframe>Dropped
&lt;, &amp;, &copy; entitiesDecoded to <, &, ©. A decoded <div> is not escaped
EmojiKept as Unicode

How does this compare with Pandoc and the Turndown library?

MDConvert (this page)Pandoc -f html -t gfmTurndown (npm)
Install neededNo, runs in the browserYes, command-line programYes, add it to a JS project
ConverterTurndown + GFM pluginPandoc's own HTML readerSame as this page
Custom rulesNoYes, Lua filtersYes, addRule, keep and remove
Many files / scriptingNo, one paste at a timeYesYes, from your own code
Output flavoursGitHub-flavored MarkdownMany (gfm, commonmark, markdown_strict and more)Configurable via options
Your HTML leaves your machineNoNoNo

For a one-off snippet, this page is quickest. For a site migration with hundreds of pages, script Pandoc or Turndown so you can fix edge cases once with a rule.

Maintained by Ankit Aglawe. Last updated .

Related Tools

Need a different format? See every tool on the Markdown converter page, or go back to the MDConvert home page.

HTML to Markdown questions

Can I convert a saved .html file?
Yes. Click Upload at the top of the tool and pick the file. Its source is loaded into the editor and converted straight away. You can then download the result as a .md file.
Why are there three spaces after each list dash?
That is Turndown's default list indent. Markdown renderers treat "- item" and "- item" the same, so the list renders correctly. Run the output through the Markdown Formatter if you want single spaces.
Can I paste a whole HTML page, <head> and all?
Yes. <script>, <style> and <title> elements are removed, so their contents do not end up in the Markdown. Navigation, footers and sidebars are still converted, because they are ordinary HTML; trim those yourself or use URL to Markdown.
Are relative links and image paths fixed?
No. A link to /docs or an image at img/logo.png is copied exactly as written. If you need absolute URLs, use the URL to Markdown tool, which resolves them against the page address.
Why do some characters get a backslash?
Text that would be read as Markdown is escaped so it stays literal. A paragraph starting with "1." becomes "1\." and *stars* become \*stars\*, so they don't turn into a list or italics.
Is the HTML sent anywhere?
No. Turndown runs inside the page in your browser. The HTML you paste is not uploaded or stored.