§

Paste HTML

§

Raw

§

Preview

Preview is sanitized via DOMPurify — script tags, event handlers, and javascript: URIs are stripped before render.

Markdown is the lingua franca of US and UK software documentation. Every GitHub README, Stack Overflow answer, and Reddit comment passes through a Markdown parser, and the 100M+ developer posts on Stack Overflow rely on CommonMark for trustworthy rendering. US federal labs run MkDocs and Sphinx pipelines that turn Markdown source files into static documentation portals, while GOV.UK content designers author service pages in Markdown before publication. Notion, Obsidian, and Bear ship Markdown-first note-taking to millions of US and UK knowledge workers, and Substack newsletters compile Markdown drafts into HTML emails. Converting exported HTML back to Markdown is daily work for technical writers, open-source maintainers, and platform engineers across both markets.

What is HTML to Markdown conversion?

HTML is the rendered markup the browser displays — <h1>, <ul>, <table>, <a>, and the rest. Markdown is a lightweight plain-text format that uses minimal punctuation (# for headings, * for emphasis, - for list items) to encode the same structure. GitHub Flavored Markdown (GFM) extends the original CommonMark spec with tables, strikethrough, task lists, and autolinks. Converting HTML to Markdown pulls rendered or exported HTML back into editable plain-text Markdown — exactly what a content migration off a CMS, or a README cleanup, needs.

Which GitHub Flavored Markdown features does the output support?

The bundled turndown@7.2.0 engine with the turndown-plugin-gfm extension emits the full GFM superset from your HTML: ATX-style headings # through ###### from <h1><h6>, ordered and unordered lists with nesting, bold **text** and italic *text*, strikethrough ~~text~~ from <del>, inline links [text](url) and images ![alt](src), fenced code blocks with language hints (```js), inline code spans `code`, pipe tables from <table>, GFM task lists - [ ] / - [x] from checkbox inputs, blockquotes >, and horizontal rules ---. The preview pane re-renders the emitted Markdown with marked@12.0.2 so you can confirm the conversion visually.

How does HTML to Markdown conversion work?

Every conversion runs locally in your browser using three bundled libraries — no CDN, no fetch, no telemetry. The high-level steps are:

  1. Sanitize: the pasted HTML is first run through DOMPurify.sanitize(html, { USE_PROFILES: { html: true } }) to strip <script> elements, every on* event handler, and javascript: URIs before anything walks the markup. DOMPurify is the same XSS sanitizer used by Mozilla MDN, Atlassian, and Microsoft 365.
  2. Convert: turndownService.turndown walks the cleaned DOM and emits GitHub Flavored Markdown — headings become # prefixes, lists become - / 1. items, <table> becomes a pipe table, and so on. The Markdown is written to the read-only output <textarea> via value (never innerHTML), so it is inherently safe.
  3. Render: the emitted Markdown is re-parsed by marked.parse, sanitized again through DOMPurify, and assigned to the preview pane's innerHTML so you get a visual confirmation that the Markdown round-trips to the expected structure. Live mode debounces input by 150 ms so the output updates as you paste without thrashing the parser.

Why convert HTML to Markdown with this tool?

  • Privacy: every sanitize, convert, and render pass happens in your browser. The HTML — including exported CMS posts, internal documentation, and confidential page source — never reaches our servers.
  • XSS-safe by default: the pasted HTML is run through DOMPurify before turndown walks it, and the preview pane runs the re-rendered HTML through DOMPurify again before innerHTML, so pasting markup that contains <script> tags or onerror= handlers produces an inert preview and clean Markdown.
  • GFM-complete: <table> elements convert to Markdown pipe tables, <del> to strikethrough, and checkbox lists to GFM task lists. Most online converters drop tables on the HTML → Markdown path — the bundled turndown-plugin-gfm extension preserves them.

What are common applications of HTML to Markdown conversion?

Converting HTML to Markdown shows up across content migration, documentation, and archiving:

  • CMS migration: exporting a WordPress or Ghost post as HTML and converting to Markdown for a Hugo / Jekyll / 11ty / Astro static-site rebuild. The conversion preserves heading levels, links, lists, and inline emphasis.
  • README cleanup: pasting the rendered HTML of a wiki page or web article and pulling it back into editable Markdown for a project README or docs site, instead of re-typing the structure by hand.
  • Archiving and notes: capturing an HTML email or web clipping and converting to Markdown for storage in Obsidian, Notion, or a plain-text knowledge base — Markdown stays diff-friendly and survives format churn.

What does an HTML to Markdown example look like?

Pasting <h2>Heading</h2><ul><li>a</li><li>b<ul><li>nested</li></ul></li></ul> produces Markdown with ## Heading, a nested bullet list, and a preview pane that re-renders to the same nested structure. Pasting a <table> with a header row and two data rows produces the equivalent | col | col | pipe table — confirming the conversion preserves headings, lists, and tables.

Does this HTML to Markdown converter run entirely in my browser?

Yes. Every sanitize, convert, and render pass runs locally as JavaScript inside your browser tab. The three bundled libraries — turndown@7.2.0 (with turndown-plugin-gfm@1.0.2), marked@12.0.2, and DOMPurify@3.1.7 — ship from the same origin as the page, so there is no CDN dependency, no fetch, no XMLHttpRequest, no navigator.sendBeacon on the input. The tool also works offline once the page has loaded, because it is a static HTML/CSS/JS bundle with the vendor libraries copied alongside it. Exported posts, internal docs, and confidential page source stay on your device.

Is the rendered preview pane XSS-safe?

Yes. The pasted HTML is run through DOMPurify.sanitize before turndown walks it, and every HTML string assigned to the preview's innerHTML passes through DOMPurify.sanitize(html, { USE_PROFILES: { html: true } }) as well. DOMPurify is the open-source XSS sanitizer maintained by Cure53; it is the same library used by Mozilla MDN, Atlassian, and Microsoft 365 to harden user-supplied HTML. The default html profile removes <script> elements, every on* event-handler attribute (onerror, onclick, etc.), and javascript: URI schemes. Pasting <img src=x onerror=alert(1)> produces a preview where document.querySelector('#output-preview img[onerror]') returns null and no alert fires.

Are GFM tables converted from HTML?

Yes. The HTML → Markdown direction uses turndown-plugin-gfm, which adds a custom turndown rule that walks <table> nodes and emits the equivalent pipe-table Markdown — a header row, a |---|---| alignment row, then data rows. Most online converters drop tables on this path; this one preserves them. Strikethrough (<del>text</del>~~text~~) and task lists (<input type="checkbox">- [ ] / - [x]) convert the same way.

Will my HTML convert cleanly?

For the canonical GFM feature set — headings h1 through h6, ordered and unordered lists with nesting, bold / italic / strikethrough, inline links, inline images, fenced code blocks with language tags, inline code spans, pipe tables, task lists, blockquotes, horizontal rules, and autolinks — the conversion is clean and predictable. Edge cases: HTML comments (<!-- ... -->) are stripped (Markdown has no comment syntax); inline styling and class attributes are dropped because Markdown has no equivalent; and uncommon inline tags such as <sub> / <sup> are converted to plain text. These are documented turndown behaviours, not bugs.

Is syntax highlighting in fenced code blocks supported?

Not in v1. Fenced code blocks render in the preview with monospaced font and a subtle background but without per-language token highlighting. Adding syntax highlighting would require bundling Prism or highlight.js, each of which adds 15–40 KB plus a per-language grammar file and a theme matrix that would need alignment with the Workshop Terminal palette. For now, the renderer focuses on correctness and XSS-safety; if there is user demand for inline highlighting, an opt-in toggle is a tractable follow-up.

This HTML to Markdown Converter ships with turndown@7.2.0 (+ turndown-plugin-gfm@1.0.2), marked@12.0.2, and DOMPurify@3.1.7 bundled at the same origin, emits the full GFM feature set, and sanitizes every rendered HTML string before it touches the DOM. No upload, no CDN, no telemetry — every byte stays in your browser.