DevToolsmith

HTML to Markdown Converter

Paste HTML, from a web page, a CMS or an email, and get clean Markdown back. Headings, links, images, lists, tables and code blocks with their language are converted; scripts and styles are dropped.

Runs 100% in your browser — nothing is uploaded

HTML
Tip: drop a file here707 chars · 707 bytes · 15 lines
Markdown
0 chars · 0 bytes · 0 lines

How elements are converted

HTMLMarkdown
<h2>Title</h2>## Title (or underlined with ---)
<strong>, <b>**bold**
<em>, <i>_italic_ or *italic*
<a href="url">text</a>[text](url)
<img src="a.png" alt="x">![x](a.png)
<ul><li>- item
<pre><code class="language-js">Fenced block ```js
<blockquote>> quote
<del>, <s>~~strike~~ (GFM)
<script>, <style>Removed

Converting in code

JavaScript (turndown)
import TurndownService from 'turndown';
import { gfm } from 'turndown-plugin-gfm';

const td = new TurndownService({ headingStyle: 'atx', codeBlockStyle: 'fenced' });
td.use(gfm);
const markdown = td.turndown(html);
pandoc
pandoc page.html -f html -t gfm -o page.md

Check the result in the Markdown preview, or build tables by hand with the Markdown table generator.

Frequently asked questions

How do I convert a web page to Markdown?

Open the page, select the content and copy it, then paste the HTML source here: in DevTools, right-click the article element and choose Copy → Copy outerHTML. Scripts, styles and forms are dropped; headings, paragraphs, links, images, lists, tables and code blocks are converted.

Are tables converted?

Yes, with GFM tables on, simple tables become pipe tables. Markdown tables can’t express merged cells (colspan/rowspan), nested tables or block content such as lists inside cells, so such tables are kept as HTML, which Markdown renderers display as is.

Does it keep the language of code blocks?

Yes. Code blocks marked up as <pre><code class="language-python"> (the convention used by GitHub, Prism, highlight.js and most static site generators) become fenced blocks with the language, like ```python. If the code itself contains ```, the fence switches to ~~~ so the block isn’t cut short.

Why do some characters get a backslash?

Characters with a meaning in Markdown, such as *, _, # at the start of a line or [ ], are escaped when they appear in normal text, so they display literally instead of turning into formatting. This keeps the Markdown faithful to the original HTML.

What library does this use?

Turndown, a popular HTML-to-Markdown converter, with its GitHub Flavored Markdown plugin for tables, strikethrough and task lists. It runs in your browser, so pasted content isn’t uploaded.