Skip to main content

HTML to Markdown

Transform HTML headings, paragraphs, links, lists, quotes and code into Markdown without sending content to a server.

  • Clipboard
  • Export
Automate

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Was this tool useful?

How does this tool work?

Convert HTML to readable Markdown to retrieve the content of a web page, email or CMS export in a format that is easy to edit, version or publish in documentation. Titles, paragraphs, lists, links, images, quotes and blocks of code are included; layout tags are removed. Everything happens in your browser.

The converter first removes <script> and <style> tags together with their contents. Blocks inside <pre>, with or without <code>, become fenced code blocks delimited by ```. Their content is decoded and preserved: &lt;div&gt; in a code example becomes <div> rather than being removed as a tag.

Headings <h1> through <h6> become # through ######. <strong> and <b> become **bold**, <em> and <i> become *italic*, and <code> becomes inline code. Links use [text](address), while images use ![text](address), even without an alt attribute. <ul> lists use “-” bullets; <ol> lists start at 1 or the value of their start attribute. <blockquote> becomes a quotation, <hr> a horizontal rule and <br> a line break.

Containers such as div, section, article and table are removed and replaced with paragraph breaks. HTML entities (&amp;, &nbsp;, &#233;…) are decoded. Tables are not rebuilt as Markdown tables: their cell contents become text that needs manual formatting.

How to use this tool

  1. Paste HTML

    Enter or import the code in the “HTML Source” field.

  2. Convert

    Run the conversion to obtain the corresponding Markdown.

  3. Proofread and adjust

    Check the links, images and any tables, then copy the result.

Use cases

Migrate documentation

Retrieve HTML pages to integrate them into a repository or Markdown site generator.

Clean up copied content

Remove text from its layout tags while keeping titles, lists and links.

Archive an article

Keep the content of a page in a light, readable text file.

Examples

Title, formatting and list

Input

<h2>Summary</h2><p>A <strong>text</strong> with a <a href="https://example.com">link</a>.</p><ul><li>Point A</li><li>Point B</li></ul>

Result

## Summary

A **text** with a [link](https://example.com).

- Point A
- Point B

Numbered list and code block

The numbering resumes at 3 thanks to the start attribute and the HTML code of the example is preserved.

Input

<ol start="3"><li>Check</li><li>Publish</li></ol><pre><code>&lt;p&gt;Hello&lt;/p&gt;</code></pre>

Result

3. Check
4. Publish

```
<p>Hello</p>
```

Tips and best practices

  • Preferably copy the main content of the page (the article or main element): menus, footers and forms would otherwise be converted into text.
  • The relative addresses of links and images (/contact, img/photo.jpg) are kept as they are: complete them if the Markdown must live elsewhere.
  • Then check the rendering with Markdown preview, and harmonize the syntax with Markdown formatter if necessary.

Sources and references

Frequently asked questions

Are HTML tables converted?

No. The table tags are removed and the contents of the cells are kept as text: the Markdown table must be recreated by hand.

What happens to scripts and styles?

The <script> and <style> tags are deleted with their content; the class, id or style attributes disappear with the tags.

Are nested lists preserved?

The elements are all included, but the nesting is not restored by indentation: reread the lists at several levels.

Are accented characters and entities supported?

Yes. Common named entities (&amp;, &lt;…) and numeric entities (&#233;, &#xE9;) are decoded into characters.

Is the HTML sent to a server?

No. The conversion takes place in your browser, without loading the images or links present in the code.

Related tools

Tools similar or complementary to this one.

Similar tools

Convert Markdown into clean HTML directly in your browser.

Text & writingUse this tool

Write Markdown and instantly preview the rendered HTML.

Text & writingUse this tool

Generate Lorem Ipsum placeholder text for mockups, prototypes and layout tests.

Text & writingFeaturedUse this tool