About the HTML to Markdown Converter
This HTML to Markdown converter turns HTML markup into clean, readable Markdown. Paste a web page fragment, a CMS or WordPress export, an email template or rich text copied as HTML, and get Markdown ready for a README, a static-site generator such as Hugo, Jekyll or Astro, a documentation site, a wiki or a note-taking app like Obsidian.
It converts headings, paragraphs, bold, italic and strikethrough, links and images (with titles), inline code and fenced code blocks (keeping the language from class="language-…"), nested bulleted and numbered lists, blockquotes, horizontal rules, line breaks and tables, which become GitHub Flavored Markdown pipe tables. Scripts, styles, forms and other non-content elements are dropped, and HTML entities such as & and are decoded.
Choose ATX (#) or Setext (underlined) headings, the bullet character, the italic delimiter and fenced or indented code blocks to match your project’s style guide. Characters that Markdown would misread, such as * and _ in ordinary text, are escaped with a backslash so the output renders exactly like the original. Conversion runs entirely in your browser.
How to use the html to markdown converter
- 1Paste the HTML — a snippet or a whole page.
- 2Pick heading style, bullet character and italic delimiter.
- 3Choose fenced or indented code blocks.
- 4Copy the Markdown and paste it into your README, docs or notes.
Formula and method
The HTML is first parsed into an element tree with browser-like rules: void elements such as <br> and <img> need no closing tag, unclosed <p>, <li>, <tr> and <td> elements are closed implicitly, comments and doctype are skipped, and the contents of <script> and <style> are discarded. Only the <body> is converted when a full document is pasted.
The tree is then written out recursively. Block elements (headings, paragraphs, lists, blockquotes, tables, pre) are separated by a blank line; inline elements become Markdown syntax — **bold**, *italic*, ~~strike~~, `code`, [text](url "title") and . Whitespace in text is collapsed as a browser would, except inside <pre>. List items are indented to the width of their marker so nested lists stay nested, and Markdown control characters in text are backslash-escaped.
Worked examples
Release notes with a list, link and code block
The h1 and h2 become # and ## headings, <strong> and <em> become ** and *, and the link keeps its URL. Each <li> becomes a "- " item, and the <pre><code class="language-bash"> block becomes a fenced block tagged bash. Twelve HTML elements were parsed in total.
Nested ordered list and a blockquote, Setext headings
With Setext style the H2 is underlined with hyphens as long as the text (minimum three). The nested bullets are indented three spaces — the width of "1. " — so they belong to the first item, and the blockquote paragraph is prefixed with "> ".
Table, image and escaped characters
The underscore and asterisk are escaped so they are not read as italics, and & decodes to &. The row of <th> cells becomes the table header with a --- separator row, and the image becomes .
Frequently asked questions
How do I convert HTML to Markdown?+
Paste the HTML into the input box. Headings, paragraphs, emphasis, links, images, lists, code and tables are converted to their Markdown equivalents automatically, and the result can be copied straight into a README, a docs site or a Markdown note.
What happens to HTML that has no Markdown equivalent?+
Content-free elements such as <script>, <style>, forms and iframes are removed. Layout wrappers like <div>, <section> and <span> are unwrapped and their text kept. Features Markdown cannot express, such as merged table cells, inline styles or colors, are dropped.
Why are underscores and asterisks escaped with backslashes?+
In Markdown, * and _ start emphasis and [ ] start links. Escaping them in ordinary text (snake\_case, 2\*3) makes sure the rendered Markdown shows the same characters as the original HTML instead of unexpected italics.
Are HTML tables supported?+
Yes. Tables are converted to GitHub Flavored Markdown pipe tables, which GitHub, GitLab, most static-site generators and Obsidian render. The first row of header cells becomes the header; if there is none, an empty header row is added because GFM tables require one.
Should I use ATX or Setext headings?+
ATX headings (# Title) are the most common and support all six levels; Setext headings (a line of === or --- under the text) only exist for levels 1 and 2. Google’s Markdown style guide prefers ATX, while markdownlint’s default heading rule only requires one style to be used consistently.