induwara.lk
induwara.lkUtility · Developer

HTML to Markdown Converter

Paste raw HTML or rich text and get clean, spec-compliant Markdown back instantly — headings, links, GFM tables, task lists, and code blocks preserved. Everything runs in your browser; the HTML never leaves your device. No signup, no ads.

By Induwara AshinsanaUpdated Jul 10, 2026
HTML to Markdown ConverterIn-browser · no upload
Stays on your device
Everything happens in your browser. Nothing is uploaded.
Read-only. Use Copy or Download .md to take it with you.
Headings
Bullet marker
Emphasis
Code blocks
Extras
Conversion runs in your browser; no DOM is available here.
Words · Characters
0 · 0
Headings · Code blocks
0 · 0
Cross-checked by 2 methods
Links · Images
0 · 0
Tables · List items
0 · 0
GitHub-Flavored

Paste HTML on the left, or press “Load sample,” to see the converted Markdown rendered here.

The preview renders the produced Markdown back to HTML — a round-trip check that nothing was lost. Built to CommonMark 0.31.2 + GFM. Sources verified 2026-07-10, listed in “Sources & references” below.

How it works

The converter is a pure, deterministic transform: the same HTML and the same options always produce the same Markdown. There is no AI, no server, and no network call. Conversion happens in four steps.

  1. Parse.Your pasted string is parsed to a DOM tree with the browser's native DOMParser in text/html mode. This tolerates malformed or partial HTML the same way a browser tab would, so you can paste a fragment without a full document wrapper.
  2. Sanitise. When the Sanitize option is on, <script>, <style>, <iframe> and inline event handlers are removed, and dangerous URL protocols like javascript: are stripped from links. Nothing executable can survive into the output.
  3. Walk and map. The tool traverses the DOM depth-first and maps each node to CommonMark 0.31.2: <h1><h6> to ATX # headings (§4.2), <strong> to **bold** (§6.4), <a> to [text](url) (§6.6), <ul>/<ol> to lists (§5.2–5.3), <pre><code> to fenced code (§4.5), and <blockquote> to > quotes (§5.1). Text is escaped so stray Markdown delimiters render literally — with one nuance: an underscore inside a word (like snake_case) is left alone, because CommonMark §6.2 already treats intraword _ as literal.
  4. GFM extensions. With GFM extras on, <table> becomes a pipe table with a | --- | delimiter row, <del> becomes ~~strikethrough~~, and a checkbox inside a list item becomes a - [x] task list item.

The element count under the output is verified two independent ways — once by walking the parsed DOM and once by scanning the raw HTML with regular expressions. When both agree, the summary shows “cross-checked by 2 methods,” the same reconciliation approach used across the site's converters. The rendered preview then re-renders the produced Markdown back to HTML as a round-trip sanity check.

Worked examples

Inline formatting (defaults: ATX, _ emphasis)

HTML in

<h1>Hello</h1>
<p>This is <strong>bold</strong> and <a href="https://induwara.lk">a link</a>.</p>

Markdown out

# Hello

This is **bold** and [a link](https://induwara.lk).

Each <h1> maps to a single # (CommonMark §4.2), <strong> to **…** (§6.4), and the <a href> to inline [text](url) link syntax (§6.6).

GFM table, list, and code block (GFM on)

HTML in

<h2>Tasks</h2>
<ul><li>Ship v1</li><li>Write docs</li></ul>
<table><thead><tr><th>Tool</th><th>Free</th></tr></thead>
<tbody><tr><td>html2md</td><td>Yes</td></tr></tbody></table>
<pre><code>npm i turndown</code></pre>

Markdown out

## Tasks

- Ship v1
- Write docs

| Tool | Free |
| --- | --- |
| html2md | Yes |

```
npm i turndown
```

The <table> gains a | --- | delimiter row (GFM §4.10), each <li> becomes a hyphen bullet (§5.2), and <pre><code> becomes a fenced ``` block (CommonMark §4.5).

Blockquote with nested emphasis (edge: a block inside a block)

HTML in

<blockquote><p>Quote with <em>emphasis</em></p></blockquote>

Markdown out

> Quote with _emphasis_

The <blockquote> prefixes each produced line with '> ' (§5.1); the inner <em> uses the chosen emphasis delimiter, _ by default (§6.4).

Frequently asked questions

Sources & references

The mapping rules and spec citations were last cross-checked against the CommonMark and GFM specifications on 2026-07-10. The page is reviewed whenever either specification is amended.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.