HTML to Markdown

Turn HTML into readable Markdown, including lists, links, code and tables.

loading HTML to Markdown
About this tool

How do I convert HTML to Markdown?

HTML is the markup language of web pages: tags such as <h1>, <p>, <ul> and <a href>. Markdown is a light plain-text notation for the same structure, with # for headings, **bold**, - for lists and [text](url) for links. Converting HTML to Markdown gives you text that is easy to read, edit, version in Git and paste into documentation sites, README files, notes apps and chat prompts.

It is the tool to use when you move a blog from a CMS to a static site generator, when you copy the body of an article or an email template into Markdown, when you need clean text for a wiki or a knowledge base, or when you want to read what a messy HTML snippet really says.

Paste the HTML (or drop a .html, .htm or .txt file) on the box and the Markdown appears as you type, with lists, links, images, fenced code blocks and tables. The HTML is cleaned first with DOMPurify, which removes scripts and event handlers, and then converted with the Turndown library. All of it runs in your browser: your HTML is not uploaded, and the tool never fetches a web address. You paste the source, not a URL.

How to convert HTML to Markdown step by step

  1. Paste the HTML into the HTML box, or click Open a file, or drop a file on it. A small example is loaded first.
  2. Read the result in Markdown. It updates a moment after you stop typing.
  3. Under Headings, choose Hash headings (# Title) or Underlined headings. The first is the common style for GitHub, GitLab and most editors.
  4. Under List marker, choose -, * or + to match the style of your project.
  5. Click Copy to put the Markdown in the clipboard, or Download to save it as a .md file. It takes the name of the file you opened, or documento.md if you pasted text.

Examples

The basics

Input:

<h1>Hello</h1><p>This is <strong>bold</strong>, <em>italic</em> and <a href="https://example.com">a link</a>.</p><ul><li>One</li><li>Two</li></ul>

Output:

# Hello

This is **bold**, *italic* and [a link](https://example.com).

-   One
-   Two

The list items have three spaces after the marker, the layout Turndown uses; it renders the same.

A table

<table><tr><th>Name</th><th>Score</th></tr><tr><td>Ana</td><td>10</td></tr></table> becomes a GitHub-style table:

| Name | Score |
| --- | --- |
| Ana | 10 |

The first row is always used as the header. A pipe inside a cell is written as \|.

A code block

<pre><code class="language-js">const a = 1;</code></pre> becomes a fenced block starting with three backticks and js, so GitHub colours it. Only <pre> with a <code> inside becomes a fenced block; a bare <pre> comes out as ordinary text, so wrap such code in <code> first.

Underlined headings

With Underlined headings, <h1>Title</h1> becomes Title followed by a line of = signs, and <h2> a line of - signs. Levels 3 to 6 still use #, because the underlined style only exists for two levels.

Common errors and how to fix them

  • Nothing appears in the output: the input is empty or has only tags without content. Check that you pasted the HTML source, not the rendered text.
  • "Could not convert: ...": the converter raised an error on that input. The message after the colon says why; usually a very broken fragment. Try removing the part that fails.
  • My script tags and onclick handlers are gone: on purpose. Scripts and event handlers are removed before conversion, and Markdown has no way to hold them.
  • Bold or links inside a table cell are lost: cells are reduced to plain text so the table stays valid Markdown. Edit those cells afterwards if you need them.
  • Merged cells (colspan, rowspan) look wrong: Markdown tables have no merged cells, and each cell is written once in its row.
  • Layout disappeared: div, span, classes and inline styles carry no Markdown meaning, so only the content and its structure stay. That is the point of the format.

Markdown or HTML: which one should I keep?

Does converting HTML to Markdown lose anything?

Yes, anything Markdown cannot express: colours, fonts, classes, columns, forms, embedded players and exact layout. Headings, paragraphs, emphasis, lists, links, images, quotes, code and simple tables survive.

When should I not convert?

When the page is mostly layout (a landing page with grids and forms) or relies on styles and scripts. Keep HTML there. Convert when the content is text-heavy: articles, docs, notes, release notes.

Can I paste a URL?

No. The tool does not open web addresses, because it makes no network requests. Open the page, view the source or copy the HTML of the part you want, and paste it.

Is the HTML I paste uploaded or stored?

No. It is cleaned and converted in your browser. The box remembers your last input on this device only, so you can come back to it.

Is it free, and does it work on a phone?

Yes to both. It needs no account or install and runs in mobile browsers.

How do I go the other way?

Use Markdown to HTML. To compare the Markdown with a previous version, Text diff shows what changed, and the HTML WYSIWYG editor helps you write the HTML visually first.

Report a problem