How do I convert HTML to Markdown or Markdown to HTML?
Paste HTML to convert it to clean Markdown, or paste Markdown to generate HTML. The tool handles headings, links, images, lists, tables, code blocks, bold, italic, and more. Conversion is instant and bidirectional. Everything runs in your browser — your content never leaves your device.
<h1>Title</h1> <p>This is <strong>bold</strong> and <em>italic</em>.</p> <ul> <li>Item one</li> <li>Item two</li> </ul>
# Title This is **bold** and *italic*. - Item one - Item two
HTML ↔ Markdown Converter
Convert between HTML and Markdown in either direction. Handles headings, lists, code blocks, tables, links, and more.
About HTML ↔ Markdown Converter
- HTML → Markdown — converts semantic HTML elements into clean, readable Markdown syntax.
- Markdown → HTML — parses Markdown into standards-compliant HTML output.
- Heading styles — choose ATX (
# Heading) or Setext (underlined) for h1/h2. - Swap — click Swap to reverse direction and chain conversions, moving the output into the input.
- Tables, code blocks, links — all common formatting elements are preserved during conversion.
- Everything runs in your browser — no data is sent over the network.
Tips & Best Practices
Clean up HTML before converting for best Markdown output
Rich text editors (Google Docs, Word, Notion) export HTML full of inline styles, empty spans, and nested divs. Strip these before converting — Markdown has no concept of font colors or spacing divs. The cleaner the HTML input, the more readable the Markdown output.
HTML tables convert poorly to Markdown
Markdown tables don't support colspan, rowspan, cell alignment, or nested elements. Complex HTML tables with merged cells or nested lists convert to pipe tables that lose structure. For complex tables, consider keeping them as raw HTML blocks within your Markdown.
Migrate blog content from WordPress to Markdown-based platforms
Export WordPress posts as HTML, then convert to Markdown for Gatsby, Hugo, Astro, or Next.js MDX blogs. Batch-convert all posts, then manually review headings, images (update paths), and code blocks that may need syntax highlighting hints added.
Markdown-to-HTML renders can introduce XSS if not sanitized
Raw HTML is valid Markdown — a Markdown file containing <script>alert('xss')</script> will execute when rendered. Always use a sanitizing Markdown renderer (like DOMPurify + marked) that strips script tags, event handlers, and javascript: URLs from the HTML output.
Frequently Asked Questions
How do I convert HTML to clean Markdown?
Can I convert Markdown back to HTML?
What HTML elements have no Markdown equivalent?
Related Convert Tools
Tailwind to CSS Converter
Convert Tailwind CSS utility classes to standard CSS — supports 500+ classes including spacing, layout, typography, transforms, and arbitrary values
.env to Docker/K8s Converter
Convert .env files to Docker Compose environment blocks, Kubernetes ConfigMaps, Secrets, and docker run flags with sensitive key detection
JSON ↔ XML Converter
Convert JSON to XML and XML to JSON instantly — handles nested objects, arrays, attributes, CDATA sections, and XML declarations
CSS Unit Converter
Convert between px, rem, em, pt, vw, vh, and % — single values or batch-convert entire CSS files with configurable base font size