HTML to Markdown
Convert HTML into clean GitHub-Flavored Markdown via DOMParser. Handles headings, paragraphs, lists, tables with alignment, code blocks with language hints, blockquotes, task lists, links and images. Strips scripts and styles. 100% offline.
What is the HTML to Markdown?
HTML to Markdown is a DOMParser-based converter — we never use innerHTML, so scripts never execute. The output is GitHub-Flavored Markdown that round-trips cleanly through most renderers. Supported elements: all 6 heading levels (atx `#` or setext `===` style), paragraphs, `<br>` hard breaks, horizontal rules, `<strong>` and `<b>`, `<em>` and `<i>`, `<s>` / `<del>` strikethrough, inline `<code>` with automatic backtick escaping, `<pre><code>` code blocks with language hints from `class="language-foo"`, links and images with titles, blockquotes, ordered + unordered lists (with arbitrary nesting), the GFM checkbox `<input type="checkbox">` task-list extension, and tables with per-column alignment read from `align=` or `style="text-align:…"`. Scripts, styles and noscript blocks are stripped. Configure the bullet character (`-`, `*`, `+`), heading style (atx vs setext), bold (`**` vs `__`), italic (`*` vs `_`), unknown-tag handling (drop vs preserve) and optional column wrapping. Live stats track headings, paragraphs, lists, tables, code blocks, links and images.
How to use it
- Paste your HTML — a rendered email, a CMS export, scraped page content.
- Pick your output style: atx vs setext headings, bullet character, bold/italic delimiters.
- Toggle 'keep unknown HTML tags' if your input has custom elements you want preserved.
- Copy the Markdown or download as .md — paste into GitHub, Obsidian, Notion or any other Markdown renderer.
Benefits
- DOMParser-based — scripts inside the input never execute.
- GitHub-Flavored Markdown (GFM) — tables, strikethrough, task lists all supported.
- Tables preserve per-column alignment from `align=` or `text-align` styles.
- Code blocks keep language hints from `class="language-foo"`.
- Inline code uses the right number of backticks so the content survives intact.
- Configurable bullet (`-` / `*` / `+`), heading style (atx / setext), bold (`**` / `__`), italic (`*` / `_`).
- Optional column wrapping at 60–120 characters for clean line-wrapped output.
- Strips scripts, styles and noscript blocks for safety.
- Runs 100% in your browser — Toollyz has no server.
Frequently asked questions
Why DOMParser instead of regex?
Regex-based HTML parsers fail on nested tags, attribute edge cases and invalid HTML the browser silently fixes. DOMParser is the same parser your browser uses for normal page rendering — it handles every weird case correctly.
Does it execute scripts in my input?
No. DOMParser does NOT execute scripts when parsing HTML via `parseFromString`, even when the input contains `<script>` tags. We explicitly drop scripts and styles before emitting Markdown anyway.
Will it preserve tables?
Yes — table headers, rows and per-column alignment (from `align=` or `style="text-align:…"`) all carry through to GFM tables.
What about nested lists?
Yes. Lists of any nesting depth are converted; the indent is `2 × depth` spaces per the GFM convention.
Does it handle the task-list extension?
Yes. An `<input type="checkbox" checked>` inside a list item becomes `- [x]` and unchecked becomes `- [ ]`.
What about code blocks?
`<pre><code class="language-ts">…</code></pre>` becomes a fenced code block with the `ts` language tag. Inline `<code>` uses adaptive backtick counting so embedded backticks don't break the output.
Will it strip my CSS?
Yes — `<style>` blocks and inline `style` attributes are dropped (we don't try to convert CSS to anything Markdown can render).
What if my input has unknown tags?
By default we strip them (passing through their children). Toggle 'keep unknown HTML tags' on if you want them preserved as raw HTML in the Markdown output.
Does it work on broken HTML?
DOMParser is lenient — it produces a valid tree from almost anything. Unclosed tags, mismatched nesting, missing quotes all get tolerated the same way browsers tolerate them.
Is my HTML uploaded?
No. Parsing and emission run entirely in your browser.
Can I convert in the other direction?
Yes — see the Markdown to HTML tool.
Related tools
See all converters toolsMarkdown to HTML
Convert Markdown to clean HTML with live preview and templates.
HTML Minifier
Minify, optimize and validate HTML in one workspace.
Open Graph Preview
Paste HTML → Facebook / X / LinkedIn share-card preview + SEO audit.
YAML to JSON Converter
Bidirectional YAML ↔ JSON for K8s manifests and GitHub Actions.