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.
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
<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>## 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
<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>| Plan | Seats |
| --- | --- |
| Free | 1 |
| Team | 10 |
```js
const seats = plan.seats ?? 1;
```Nested list, checkbox, strikethrough and an image
<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>- Backend
- Move to Postgres 17
- [x] Write the changelog
~Friday~ Monday 🚀 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?
| Input | What you get |
|---|---|
| <table> with <th> or <thead> in the first row | GFM pipe table with a | --- | separator row |
| <table> with no header row | Left as raw HTML |
| A | character or a <p> inside a table cell | Not 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> |  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 |
| <, &, © entities | Decoded to <, &, ©. A decoded <div> is not escaped |
| Emoji | Kept as Unicode |
How does this compare with Pandoc and the Turndown library?
| MDConvert (this page) | Pandoc -f html -t gfm | Turndown (npm) | |
|---|---|---|---|
| Install needed | No, runs in the browser | Yes, command-line program | Yes, add it to a JS project |
| Converter | Turndown + GFM plugin | Pandoc's own HTML reader | Same as this page |
| Custom rules | No | Yes, Lua filters | Yes, addRule, keep and remove |
| Many files / scripting | No, one paste at a time | Yes | Yes, from your own code |
| Output flavours | GitHub-flavored Markdown | Many (gfm, commonmark, markdown_strict and more) | Configurable via options |
| Your HTML leaves your machine | No | No | No |
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.