Homeโ€บFormattersโ€บCodeโ€บHTML to Markdown Converter

HTML to Markdown Converter

Code

Convert HTML to Markdown instantly in your browser. Handles headings, links, lists, bold, italic, code blocks, and blockquotes. No data uploaded.

Reviewed by the thecalcu.com team ยท Last updated July 1, 2026

What is a HTMLโ†’MD?

An HTML to Markdown formatter converts HTML markup into readable Markdown syntax. It transforms tags like <h1>, <strong>, <a href="...">, <ul>/<li>, and <pre><code> into their Markdown equivalents, #, **, [text](url), - item, and fenced code blocks, producing clean plain text that any Markdown-aware platform can render correctly.

HTML and Markdown solve the same problem, representing formatted text in plain-text files, but Markdown is far easier to write and read. HTML is the native format of the web browser; Markdown is the native format of developer documentation, technical blogs, wikis, and modern headless CMS platforms. As teams migrate content from legacy HTML-heavy CMSes to Markdown-based systems (Notion, Obsidian, Ghost, Hugo, Docusaurus), the need to convert existing HTML content without manual reformatting is a common, practical problem.

The formatter handles the most common prose elements: six levels of headings, bold and italic emphasis, inline and block code, hyperlinks, images, ordered and unordered lists, blockquotes, and horizontal rules. It decodes HTML entities so &amp; becomes & in the output, and strips non-content tags like <script>, <style>, and <meta> automatically. Use it alongside the Markdown to HTML Formatter for the reverse workflow, or the Markdown Formatter to clean up the Markdown output.

Why Use an HTML to Markdown Formatter?

Manually converting HTML to Markdown is error-prone and slow. A 500-word HTML article may have twenty or more tags to translate, and it is easy to leave an unclosed </strong> behind or forget to format a link. The formatter handles all of this mechanically in under a second.

The most common use case is migrating blog posts or documentation from a WordPress or legacy CMS export into a Markdown-first platform. Export the post as HTML, paste it here, and the Markdown is ready to import.

Who Should Use This Formatter?

Content managers migrating between platforms who have HTML archives of articles, documentation, or marketing pages benefit most. A batch of HTML files can each be run through the formatter before import.

Developers writing documentation who receive copy in HTML format from designers or copywriters can convert it to Markdown before committing it to a documentation repository.

Technical writers maintaining documentation in systems like Docusaurus, MkDocs, or Gatsby that accept only Markdown can use the formatter to process HTML snippets received from subject-matter experts.

Bloggers moving from WordPress to Ghost or Hashnode will find the formatter useful for migrating post archives without touching each post manually.

What Insights Does the HTML to Markdown Formatter Give You?

The output Markdown tells you immediately how much of your HTML content is semantic. If the output looks clean and reads naturally, your original HTML was well-structured. If the output is a wall of unformatted text, your HTML relied heavily on CSS classes and <div> containers rather than semantic elements, a signal that the content may need editorial attention before migration.

Reviewing the output also reveals any non-standard HTML patterns: JavaScript-generated content (which will be missing), inline styles (which are stripped), or iframes and embeds (which are removed). These elements need manual handling after conversion.

How to use this HTMLโ†’MD calculator

  1. Copy the HTML you want to convert, a full page, an article body, or a fragment.
  2. Paste it into the HTML Input field.
  3. The Markdown output updates instantly. Review it for any elements that did not convert as expected.
  4. If links or images are missing, check that the source HTML used proper href and src attributes rather than JavaScript-driven navigation.
  5. Copy the Markdown output and paste it into your target platform, documentation file, or Markdown editor.
Show formula & methodology โ†“Show less โ†‘

Formula & Methodology

The converter applies a sequential rule-based substitution pipeline:

1. <pre><code> blocks are extracted first and converted to fenced code blocks (```).
2. Headings h1โ€“h6 are replaced with the corresponding number of # characters.
3. Block elements: <blockquote>, <hr> are converted.
4. List containers <ul> and <ol> with their <li> items are converted.
5. Inline elements: <strong>, <b>, <em>, <i>, <code>, <a>, <img>, <br>.
6. <p> tags are converted to paragraph breaks.
7. Remaining HTML tags are stripped.
8. HTML entities are decoded.
9. Multiple consecutive blank lines are collapsed to a single blank line.

Before/after example:

Input:
html <h2>Getting Started</h2> <p>Install with <code>npm install zod</code>. See the <a href="/docs/">docs</a>.</p> <ul><li>Fast</li><li>Type-safe</li></ul> 

Output:
```markdown

Getting Started

Install with npm install zod. See the docs.

  • Fast
  • Type-safe

Frequently Asked Questions

What is an HTML to Markdown formatter?
An HTML to Markdown formatter converts HTML markup into Markdown syntax. It translates HTML elements such as headings, bold, italic, links, lists, and code blocks into their Markdown equivalents. The output is clean, readable plain text that renders correctly in any Markdown processor.
Why would I convert HTML to Markdown?
Markdown is easier to read and write than HTML, and it is the standard format for documentation sites, README files, blog platforms like Ghost and Hashnode, and CMS editors like Contentful and Sanity. Converting existing HTML content to Markdown lets you move it into these systems without manual reformatting.
Which HTML elements are supported?
The formatter handles headings (h1โ€“h6), paragraphs, bold and italic, inline code and code blocks, links, images, ordered and unordered lists, blockquotes, and horizontal rules. Unsupported elements such as tables, forms, and scripts are stripped or left as text.
Does the formatter preserve links and images?
Yes. Anchor tags become `[link text](url)` and image tags become `![alt text](src)`. The href and src attributes are preserved. If an image tag has no alt attribute, the Markdown alt text is left empty.
What happens to inline styles and class attributes?
Inline styles and class attributes are stripped. Only the semantic content is preserved. If your HTML relies on CSS classes to convey meaning (e.g. a warning box styled with a class), that visual meaning will not be present in the Markdown output.
Can I paste a full HTML page or just a fragment?
Both work. You can paste an entire HTML document (including head and body tags) or just a content fragment. The formatter strips non-content tags like html, head, meta, and script, leaving only the visible content.
Is my HTML content uploaded or stored anywhere?
No. All conversion happens entirely in your browser. Your HTML is never sent to a server. This makes the tool safe to use with proprietary or sensitive content.
How do I handle HTML tables in the output?
HTML tables are not converted to Markdown tables, they are stripped to their text content. If you need tables in Markdown, use the [Markdown Formatter](/markdown-formatter/) to format your Markdown after pasting the table rows manually, or use a dedicated table formatter.
What is the difference between HTML to Markdown and Markdown to HTML conversion?
HTML to Markdown is the reverse operation of Markdown to HTML. You use HTML to Markdown when migrating content out of an HTML-first system into a Markdown-first system. Use the [Markdown to HTML Formatter](/markdown-to-html-formatter/) when you need to render Markdown as HTML for a webpage.
Does the formatter handle HTML entities like &amp; or &nbsp;?
Yes. Common HTML entities are decoded: &amp; becomes &, &lt; becomes <, &gt; becomes >, &quot; becomes ", and &nbsp; becomes a regular space. This prevents entity codes from appearing literally in your Markdown output.
What should I do if the output Markdown looks wrong?
Paste only the relevant section of your HTML rather than the full page. Remove script tags, style blocks, and navigation elements first. Complex nested HTML with div-heavy layouts may not convert cleanly, focus on article or prose content for best results.
Also known as
HTML to Markdownconvert HTML to MDHTML to MD converterHTML markdownstrip HTML to Markdown