HTML to Markdown Converter
Convert HTML to Markdown and Markdown to HTML instantly in your browser. Free online converter with auto-format detection, GFM table support, and round-trip fidelity.
Updated
What is the HTML to Markdown Converter?
Convert HTML to Markdown and Markdown to HTML instantly — right in your browser, with zero server uploads.
This free online tool handles bidirectional conversion between HTML and GitHub Flavored Markdown. Paste your content, and the output appears in real time. It auto-detects whether your input is HTML or Markdown, so you can start converting immediately without selecting a mode manually.
Who is this for?
- Developers converting documentation, README files, or CMS content between formats
- Technical writers migrating content from HTML-based editors to Markdown-based platforms like GitHub, GitLab, or Notion
- Content creators cleaning up rich-text pastes into clean, portable Markdown
- Students and learners exploring how HTML markup maps to Markdown syntax
What makes this converter different?
Unlike browser extensions that require installation or CLI tools that need terminal access, this converter runs entirely client-side in your browser. Your data never leaves your device — there are no server uploads and no API calls.
It supports the full range of GitHub Flavored Markdown (GFM) features including tables, fenced code blocks with syntax highlighting hints, nested lists, blockquotes, strikethrough, images, and autolinks. Inline HTML elements like <mark>, <sub>, <sup>, and <kbd> are preserved during Markdown → HTML conversion for maximum fidelity.
The round-trip conversion is designed to be reliable: convert HTML to Markdown, then back to HTML, and the structure stays intact. This is a common pain point in competing tools where nested lists, tables, or code blocks degrade after a single conversion cycle.
How it works
The converter uses two distinct pipelines depending on the direction of conversion. Both run entirely in your browser using pure JavaScript — no external libraries, no server round-trips.
HTML → Markdown
Parse: The raw HTML string is passed to the browser's native
DOMParser, which produces a standards-compliant DOM tree. This handles malformed HTML gracefully, so you don't need perfectly valid markup.Walk the tree: A recursive tree walker visits every node. Block-level elements (headings, paragraphs, lists, tables, code blocks, blockquotes) are handled by a block converter. Inline elements (bold, italic, links, images, inline code, strikethrough) are handled by a separate inline converter.
Emit Markdown: Each HTML element is mapped to its Markdown equivalent:
<h1>–<h6>→#through######<strong>/<b>→**bold**<em>/<i>→*italic*<a href="…">→[text](url)<img src="…">→<pre><code>→ fenced code blocks with language class detection<table>→ GFM pipe tables with header separators<ul>/<ol>→ bullet and numbered lists with proper nesting indentation
- Clean up: Entity references (
&,<, etc.) are decoded. Extra whitespace is collapsed. The output is trimmed and terminated with a single newline.
Markdown → HTML
Tokenize: The Markdown input is split into lines and parsed into a stream of block tokens — headings, paragraphs, fenced code blocks, blockquotes, lists, tables, horizontal rules, and passthrough HTML.
Render blocks: Each block token is converted to its HTML equivalent. Nested structures like blockquotes recurse back through the converter. Lists track indentation depth for proper nesting.
Process inline content: Within each block, an inline parser handles emphasis, bold, code spans, links, images, strikethrough, autolinks, and passthrough HTML tags. The inline parser works character-by-character to handle overlapping syntax correctly (e.g., bold inside a link label).
Escape and assemble: Special HTML characters in code blocks and text content are escaped to prevent XSS. The final HTML is assembled with proper semantic tags and clean formatting.
Auto-detection
When you paste content, the tool scores your input against known patterns for both HTML and Markdown. HTML indicators include tag syntax (<div>, </p>), DOCTYPE declarations, and attribute patterns. Markdown indicators include heading prefixes (## ), list markers, fenced code fences, link syntax, and blockquote prefixes. The format with the higher score is selected automatically, and you can override it with the mode toggle at any time.
Examples
Convert a blog article
Paste an HTML article with headings, paragraphs, and links to get clean Markdown output.
Convert an API reference table
Transform an HTML table with code snippets into a GitHub Flavored Markdown table.
Convert Markdown to HTML
Switch to Markdown → HTML mode and paste Markdown to get clean, semantic HTML output.
Frequently asked questions
How do I convert HTML to Markdown?
How do I convert HTML to Markdown?
Paste your HTML into the left panel. The converter automatically detects the input format and generates clean GitHub Flavored Markdown in the right panel. Click the Copy button to copy the output to your clipboard.
How do I convert Markdown to HTML?
How do I convert Markdown to HTML?
Click the MD → HTML toggle button in the toolbar, then paste your Markdown content. The tool will produce semantic HTML output. You can also use the Swap button to reverse the direction and carry the current output into the input field.
Is my data safe? Does this tool upload my content to a server?
Is my data safe? Does this tool upload my content to a server?
No. All conversion happens entirely in your browser using client-side JavaScript. Your content is never sent to any server, never stored remotely, and never logged. You can verify this by disconnecting from the internet — the tool still works.
What HTML tags are supported?
What HTML tags are supported?
The converter handles all common HTML elements: headings (h1–h6), paragraphs, links, images, bold, italic, strikethrough, inline code, fenced code blocks, ordered and unordered lists (including nested), blockquotes, tables, horizontal rules, <details>/<summary>, and inline HTML passthrough elements like <mark>, <sub>, <sup>, and <kbd>.
Does it support GitHub Flavored Markdown (GFM)?
Does it support GitHub Flavored Markdown (GFM)?
Yes. The output uses GFM syntax including pipe tables with header separators, fenced code blocks with language hints, strikethrough (~~text~~), and task list-compatible list formatting. This makes the output directly usable on GitHub, GitLab, Bitbucket, and other platforms that support GFM.
Can I convert tables from HTML to Markdown?
Can I convert tables from HTML to Markdown?
Yes. HTML <table> elements are converted to GFM pipe tables. The first row is treated as the header, and a separator row with --- is automatically inserted. Cell content including inline formatting, links, and code is preserved.
Will nested lists be preserved during conversion?
Will nested lists be preserved during conversion?
Yes. Both ordered and unordered nested lists are supported. The converter tracks indentation depth and preserves the hierarchy. Nested lists inside list items, including mixed ordered and unordered nesting, are handled correctly.
Can I round-trip convert HTML → Markdown → HTML?
Can I round-trip convert HTML → Markdown → HTML?
Yes. The converter is designed for round-trip fidelity. Convert HTML to Markdown, swap the direction, and convert back — the structure should remain intact for headings, paragraphs, lists, tables, code blocks, and inline formatting. Minor whitespace differences may occur, but semantic structure is preserved.
Why should I use this instead of a browser extension?
Why should I use this instead of a browser extension?
Browser extensions require installation, have access to all your browsing data, and only work in one browser. This tool works instantly in any modern browser without installation, runs entirely client-side with no data leaving your device, and provides bidirectional conversion with format auto-detection — features most extensions lack.
What is the keyboard shortcut to swap conversion direction?
What is the keyboard shortcut to swap conversion direction?
Press Ctrl+Shift+M (or Cmd+Shift+M on macOS) to instantly swap the input and output, reversing the conversion direction. The current output becomes the new input, so you can iterate on conversions without copy-pasting.
Does the converter handle inline HTML elements?
Does the converter handle inline HTML elements?
Yes. When converting Markdown to HTML, inline HTML tags present in the Markdown source (such as <mark>, <sub>, <sup>, <kbd>, <abbr>) are passed through to the HTML output. When converting HTML to Markdown, these elements are rendered as their HTML equivalents in the Markdown output since Markdown has no native syntax for them.
Is this tool free to use?
Is this tool free to use?
Yes. This HTML to Markdown converter is completely free with no usage limits, no account required, and no hidden fees. Use it as often as you need for personal or commercial projects.
Related tools
More utilities you might find handy.
Base64 Encoder / Decoder for Text, Images & Docs
Instantly convert plain text, images, PDFs, and documents to Base64 strings or decode Base64 data arrays back into downloadable file assets.
Binary to Hex
Convert binary numbers to hexadecimal quickly with support for padding, two's complement, bit-widths, grouping and BigInt-sized inputs
Camel, Snake, Kebab Case Converter
Effortlessly convert text between camelCase, snake_case, kebab-case, PascalCase, and more for developers and writers.