HTML to Markdown

Paste the HTML of a page or a fragment. The tool reads it in your browser, keeps the text and the structure, and writes CommonMark Markdown that you can copy.

Free Runs in your browser Checked Tuesday, November 10, 2026

This tool runs in your browser. What you enter is not sent to us.

How to use it

  1. Paste the HTML into HTML. The sample shows a heading, a paragraph with emphasis and a link, and a list.
  2. Read Markdown (CommonMark): it updates as you type.
  3. Copy it with the copy button and save it as a .md file, or paste it into a Markdown editor.

What is converted and how

Headings h1 to h6 become ATX headings with one to six hash marks. strong and b become bold text, and em and i become *italic text*. A code element becomes a code span, and a pre element a fenced code block, with its language kept when the code has a language- class. A br becomes a hard line break, a blockquote gets a > before each line, and ul and ol become lists with - and a number. An a element with an href becomes a link, and an img with a src becomes an image with its alt text (CommonMark sections 4.2, 4.5, 5.1, 5.2, 6.1, 6.2, 6.3 and 6.7).

A character that Markdown would read as markup is escaped with a backslash: the asterisk, the underscore, the backtick, the square brackets and the angle bracket, and a line that would start like a heading, a quote or a list. Section 2.4 of CommonMark allows a backslash before any ASCII punctuation character.

What is not kept

Scripts, styles, templates, frames, form controls and media are left out with their content. Attributes other than href, src, alt and title are dropped. CommonMark has no table, underline or colour, so a table becomes one paragraph for each cell, and the text of u, span and similar elements is kept without its formatting.

Three elements and a character to escape

Each HTML fragment in the table gives the Markdown in the right column, as the tool writes it.

What the HTML holds Markdown
A level 2 heading with the text Notes ## Notes
A paragraph with bold text Some **bold** text
A list with one item, First - First
The text 5 * 3 = 15, with an asterisk 5 * 3 = 15

Frequently asked questions

Why does the Markdown contain backslashes?

A backslash shows that the next character is text and not markup, such as an asterisk or a bracket. CommonMark removes it when the Markdown is rendered (section 2.4), so the page shows the characters as they were in the HTML.

Does the tool run my HTML or keep it on the page?

No. The HTML is parsed by DOMParser into a separate document, which has no browsing context and does not run scripts. The tool copies its text and structure, and shows the Markdown as text.

Why do tables become paragraphs?

CommonMark has no table syntax; the pipe tables that some services add are an extension. Each cell becomes a paragraph, so the words are kept but the layout of the table is not.

Are links and images kept?

Yes. An a element with an href becomes a link, with its title if it has one, and an img with a src becomes an image whose alt text is escaped. Other attributes are not kept.

What happens to elements that have no Markdown form?

Their text stays and their formatting is dropped. For example, span, u and mark keep the words they contain, and a div or section starts a new paragraph of text.

Sources

Figures and text last checked on Tuesday, November 10, 2026.

We use necessary cookies to run the site. With your consent, Google also uses advertising cookies to show personalised ads. If you reject them, you still see ads, but they are not personalised.