Skip to main content
← All Articles · · 7 min read

HTML to Markdown Converter Online: Clean Up Any HTML in Seconds

Convert HTML to Markdown free online — paste any webpage, CMS export, or email HTML and get clean Markdown output ready for GitHub, docs, or static sites.

markdownhtmlconverterdeveloper-toolsdocumentationfree-tools

HTML to Markdown Converter Online: Clean Up Any HTML in Seconds

You copied content from a webpage, exported something from a CMS, or received an HTML email template. Now you need clean Markdown — for a GitHub README, a documentation site, a static blog, or a Notion page.

Convert HTML to Markdown Free →

Manually rewriting HTML to Markdown is tedious. A good HTML-to-Markdown converter does it instantly — and gets you 90% of the way there even with messy, real-world HTML.


Why Convert HTML to Markdown?

Markdown has become the default format for developers. GitHub READMEs, technical docs, static site generators (Astro, Hugo, Next.js), and writing tools like Notion and Obsidian all use it. But most content on the web lives in HTML.

Common use cases:

  • Migrating blog posts from WordPress or Ghost to a static site
  • Cleaning up CMS exports before importing into a new platform
  • Scraping article content and saving it as portable Markdown
  • Converting email templates to readable plain text
  • Writing GitHub documentation from existing HTML pages
  • Processing API responses that return HTML-formatted content

How HTML to Markdown Conversion Works

Under the hood, a good HTML-to-Markdown converter maps HTML elements to their Markdown equivalents:

HTMLMarkdown
<h1>Title</h1># Title
<h2>Section</h2>## Section
<strong>bold</strong>**bold**
<em>italic</em>*italic*
<a href="url">Link</a>[Link](url)
<img src="img.png" alt="...">![...](img.png)
<code>snippet</code>`snippet`
<pre><code>block</code></pre>```code block```
<ul><li>item</li></ul>- item
<ol><li>item</li></ol>1. item
<blockquote>text</blockquote>> text
<hr>---

The tricky part is handling nested structures, custom CSS classes, inline styles, and non-semantic HTML — things like <span style="font-weight:bold"> that should become **bold**.


Step-by-Step: Convert HTML to Markdown Online

  1. Open the HTML to Markdown tool
  2. Paste your HTML — this can be a full page, a fragment, or a snippet copied from DevTools
  3. Click Convert — the tool processes the HTML and outputs clean Markdown
  4. Review the output — check headings, links, images, and code blocks
  5. Copy to clipboard — paste directly into your README, docs site, or editor

The tool handles:

  • Nested lists (ordered and unordered)
  • Inline code and code blocks with language hints
  • Tables (when the HTML uses <table> properly)
  • Links with titles
  • Images with alt text

Real-World Example

Input HTML:

<h2>API Authentication</h2>
<p>To authenticate, pass your <strong>API key</strong> as a header:</p>
<pre><code class="language-bash">curl -H "Authorization: Bearer YOUR_KEY" https://api.example.com</code></pre>
<p>See the <a href="/docs">full documentation</a> for all endpoints.</p>

Output Markdown:

## API Authentication

To authenticate, pass your **API key** as a header:

```bash
curl -H "Authorization: Bearer YOUR_KEY" https://api.example.com

See the full documentation for all endpoints.


Clean, readable, and ready to paste into any Markdown editor.

---

## Handling Messy HTML

Real-world HTML is rarely clean. Here's how to handle common issues:

### Inline styles
Most converters strip inline styles (`style="color: red"`). If styling matters, you'll need to manually add Markdown emphasis or keep the HTML inline.

### Nested tables
Complex HTML tables with merged cells (`colspan`, `rowspan`) don't convert well to Markdown because Markdown tables don't support those features. For complex tables, keep the HTML or restructure as a list.

### Custom components
If the HTML uses React-style component markup or custom elements, the converter will likely strip or pass through those tags. Review the output for anything unexpected.

### `<div>` soup
When HTML is structured with `<div>` and `<span>` instead of semantic elements, the converter may not produce correct heading or paragraph hierarchy. Semantic HTML converts cleanly; non-semantic HTML requires manual cleanup.

---

## CLI Alternative: Pandoc

For batch conversion or automation, [Pandoc](https://pandoc.org) is the gold standard:

```bash
pandoc -f html -t markdown input.html -o output.md

Or from stdin:

echo '<h1>Hello</h1><p>World</p>' | pandoc -f html -t markdown

Pandoc preserves more formatting nuances and handles edge cases better than most online tools, but requires installation.


Use HTML to Markdown in Your Workflow

Static site migration:

  1. Export your CMS posts as HTML
  2. Batch-convert using the tool or Pandoc
  3. Add frontmatter (title, date, tags)
  4. Import into your Astro/Hugo/Next.js blog

GitHub documentation:

  1. Copy content from your existing docs site
  2. Convert to Markdown
  3. Paste into your docs/ folder or wiki

Notion import: Notion accepts Markdown natively. Converting HTML to Markdown first gives you cleaner formatting than pasting raw HTML.



Real-World Scenario

A technical writer at a software company needs to migrate 80 blog posts from a legacy WordPress installation to a new Astro-based documentation site. The posts were exported as HTML, and each file contains a mix of paragraphs, <h2> headings, code snippets wrapped in <pre><code> blocks, and the occasional image. Rewriting all of this by hand would take days.

Using a batch HTML-to-Markdown conversion workflow — either through an online tool for spot-checking or Pandoc for bulk processing — the migration takes a few hours instead. Each post gets converted, the Markdown output is reviewed for the known problem areas (tables with complex structure, inline styles on pulled quotes, custom WordPress shortcodes that the converter passes through as raw HTML), and those edge cases are fixed manually. The result is a clean src/content/blog/ directory of .md files with proper frontmatter, ready to deploy.

The same pattern applies to internal documentation. A team using Confluence decides to move their docs to a GitHub wiki. Exporting Confluence pages produces HTML. Running each page through an HTML-to-Markdown converter gives them a workable starting point. They add frontmatter, fix any heading hierarchy issues, and commit. Version-controlled, searchable, and no longer locked in a paid SaaS tool — the migration pays for itself in weeks.


Quick Tips

  1. Clean your HTML before converting. Run messy HTML through an HTML formatter or Prettier first. Well-structured HTML produces significantly cleaner Markdown output — the converter relies on semantic tags, not rendered appearance.

  2. Handle <div> soup manually for critical sections. When the source HTML uses <div class="callout"> or similar non-semantic wrappers, the converter will strip the class and flatten the content. Identify these patterns before batch conversion and decide how to handle them — usually a blockquote or a custom Markdown component in your target system.

  3. Use Pandoc for batch jobs, online tools for inspection. For single files or quick spot-checks, an online converter is faster. For converting 10+ files, write a one-liner with Pandoc and process the whole directory at once: for f in *.html; do pandoc -f html -t markdown "$f" -o "${f%.html}.md"; done

  4. Add frontmatter after conversion, not before. Convert the HTML first, then prepend the YAML frontmatter block (title, date, tags). Adding frontmatter beforehand causes some converters to try to parse it as HTML.

  5. Verify code blocks have the right language tag. Most HTML-to-Markdown converters preserve <code class="language-python"> as ```python, but they sometimes drop the language attribute when the class name format differs. Scan your output for plain ``` blocks and add the language manually for syntax highlighting.


TL;DR

HTML to Markdown conversion is a daily task for developers working across platforms. Whether you’re migrating a blog, building documentation, or cleaning up scraped content:

  1. Paste your HTML into DevPlaybook’s HTML to Markdown converter
  2. Review the output and fix edge cases
  3. Use Pandoc for bulk automation

Clean Markdown is easier to read, version-control, and maintain than raw HTML — and the conversion takes seconds.

Try the HTML to Markdown converter →

Free Download

50 CLI Commands That Save Hours Every Week

The exact Git shortcuts, file search tricks, Docker commands, and productivity hacks that senior developers use daily. Compiled from 5+ years of shipping production code.

  • Git mastery (10 cmds)
  • File & search wizardry
  • Docker & DevOps tricks
  • Process & network tools
  • Productivity boosters
  • macOS & Linux install guide

No spam. 1 email/week max. Unsubscribe anytime.

Found this guide useful? Check out our free developer tools.