Skip to content

HTML to clean Markdown converter

Paste directly from Google Docs, Notion, or web pages, or drop saved .html files to extract clean GitHub-Flavored Markdown locally.

Rich clipboard paste or raw HTML

Scripts, styles, and unsafe javascript: links are stripped in worker memory.

Or drop a saved .html or .htm file

Converted locally with Google Docs bold-span cleanup and GFM tables.

How to use HTML to Markdown

  1. Paste clipboard text or drop an HTML file into Markdown. Click inside the Rich paste target box and press Ctrl+V or Cmd+V to capture text/html clipboard markup, drop an .html, .htm, or .xhtml file, or click Load sample HTML.
  2. Tune extraction and cleanup switches. Toggle GFM pipe tables, Strip nav & footer, Keep hyperlinks, Keep images, and Omit base64 data images to match your target Markdown repository.
  3. Review or edit the HTML source. Inspect captured markup inside HTML source and click Convert to Markdown to regenerate output inside the local Web Worker.
  4. Copy or save your Markdown file. Check word, line, heading, table, and link counts, then click Copy Markdown or Download .md to save converted.md locally.

Everything runs in this browser tab. Nothing you paste or open is uploaded or logged, so it's safe for keys, tokens and private data.

How does rich clipboard HTML convert without mounting unsafe markup?

When you paste into the Rich paste target box, the handler intercepts text/html directly from the clipboard event instead of letting the browser insert live DOM nodes. A pure TypeScript tokenizer inside a Comlink Web Worker then converts headings, lists, and tables into clean GitHub-Flavored Markdown with zero network uploads.

Under the MDN DataTransfer.getData clipboard API, browsers expose both text/html and text/plain flavors on paste without executing embedded tags. Avoiding a contenteditable mount prevents external CSS rules from bleeding into the workspace and keeps page reflows fast on long docs.

Copied Google Docs selections notoriously wrap entire sections inside <b style="font-weight:normal"> before nesting <span style="font-weight:700"> for real bold words. By reading CSS font-weight values (normal and 400 stay plain; 600 through 1000, bold, and bolder output **text**), HTML to Markdown exports accurate emphasis instead of bolding whole pages. Once extracted, teams prepping LLM prompts often count BPE tokens in converted Markdown to confirm RAG chunk sizing.

GitHub-Flavored Markdown tables, task lists, and code fences

Structured technical documentation relies on syntax defined in the GitHub Flavored Markdown 0.29 Specification, which extends CommonMark with pipe tables, strikethrough (~~), and interactive checklists. Every structural block maps deterministically inside the worker so docs stay valid across GitHub, Obsidian, and static-site generators.

HTML construct Default Markdown output Option toggle or edge-case behavior
table with th / td GFM pipe table with alignment dividers Uncheck GFM pipe tables for pipe-separated lines
pre + code (language-*) Triple-backtick fenced block Switches to ~~~~ if code contains triple backticks
input[type="checkbox"] in li - [x] or - [ ] task item Supports nested ul and ol with 2 spaces per level
b / span CSS font-weight **bold** only on weight >= 600 Ignores Google Docs font-weight:normal wrappers
img with src="data:..." [Image: alt] or stripped Uncheck Omit base64 data images to retain URI

Column alignment and pipe escaping inside GFM tables

The table renderer reads thead, tbody, and tfoot sections, aligns column divider rows (---, :---:, ---:) from align attributes or CSS text-align, and pads jagged rows to uniform width. Literal | characters inside cell text escape to \|, while <br> elements inside table cells stay <br> instead of breaking the row.

Unchecking GFM pipe tables switches tables to plain |-separated lines across paragraphs for downstream editors that lack GFM extensions. Teams extracting product spreadsheets or vendor portal grids can also cross-reference shipping and order tables inside a structured ANSI X12 and EDIFACT viewer before importing into databases.

Preserving nested task lists and fenced code blocks

Ordered lists honor explicit start attributes, while nested lists indent 2 spaces per depth level and convert <input type="checkbox"> markers into - [x] or - [ ] task syntax. Clicking Load sample HTML loads a database cutover runbook showcasing Google Docs bold spans, nested task checklists, aligned columns, and SQL code.

For code samples, the converter inspects language-* or lang-* classes on <pre> or <code>, strips leading and trailing blank lines, and chooses dynamic backtick counts for inline code snippets. If a <pre> block already contains triple backticks, the fence upgrades automatically to four tildes (~~~~) so nested Markdown documentation never closes early.

Real-world web captures contain broken nesting, legacy attributes, and hidden tracking blocks alongside real prose. Following the WHATWG HTML Living Standard parsing rules, the tokenizer handles all 14 void elements (br, hr, img, input, and peers), auto-closes unclosed <p>, <li>, <td>, and <tr> tags, and decodes named HTML entities cleanly.

Isolating main or article containers from nav chrome

When Strip nav & footer is enabled, the walker looks for <main> first, falls back to <article>, and discards <nav>, <footer>, and <aside> elements before rendering text. Leaving it unchecked preserves full-document structure when converting standalone email newsletters or custom HTML partials.

Non-breaking spaces (\u00a0) normalize into standard ASCII spaces, and excessive blank lines collapse so output never carries awkward gaps around stripped sidebars. Converting cleaned documentation back into office deliverables is straightforward when you need editable Word drafts without inline HTML styles for external reviewers.

Executable and non-prose elements (script, style, noscript, template, svg, iframe, object, and head) drop completely during HTML conversion before any Markdown is emitted. Every link href and image src passes through isSafeHref(), stripping 32 ASCII control characters (\u0000 to \u0020) and downgrading javascript:, vbscript:, and data:text/html links to inert text.

Toggling Keep hyperlinks or Keep images strips link wrappers or image markdown completely when you only want clean prose. With Omit base64 data images active by default, 100 KB inline base64 screenshots collapse into [Image: alt] tokens instead of bloating repository diffs by 90% or more.

Tip: Run Load sample HTML once and inspect HTML source to see how Strip nav & footer omits top navigation links while keeping the <main> runbook intact.

When should you edit raw HTML source vs paste directly?

Edit inside HTML source when you need to fix broken markup, drop a single wrapper div, or tweak table attributes across a saved file; paste directly into Rich paste target when copying formatted notes from Google Docs, Notion, or Confluence. Both inputs feed the identical Comlink worker pipeline without saving text to any server.

After every click of Convert to Markdown (or instant checkbox change), the output bar displays live badge totals for words, lines, headings, tables, and safe links. Checking those five counts helps catch unintended boilerplate or missing headings before pasting into a CMS or static repository.

Exporting clean .md files for docs and AI pipelines

Clicking Copy Markdown writes clean UTF-8 text to your clipboard, while Download .md exports converted.md tagged with text/markdown;charset=utf-8 per the IETF RFC 7763 Markdown media type. Because zero bytes leave browser memory, private internal wikis and release runbooks stay confidential.

Once your clean .md draft passes inspection, use Clear to purge input and output from component state, or compile finished specifications into paginated handouts with Markdown to PDF right on your device.

Questions

How does Google Docs bold text convert cleanly to Markdown?

Google Docs wraps copied paragraphs inside an outer bold tag with inline CSS font-weight:normal around nested bold spans. This parser checks inline font-weight values, treats normal or 400 weights as plain text, and applies double asterisks only when font-weight is bold, bolder, or 600 through 1000.

Why do inline base64 data images bloat Markdown files?

Rich-text editors and saved web pages frequently embed screenshots as base64 strings stretching tens of kilobytes per image. Leaving Omit base64 data images enabled replaces those inline data URIs with compact alt-text placeholders while keeping external HTTPS image links intact.

How are HTML table alignments and code blocks preserved in GFM?

Header cells carrying align attributes or CSS text-align rules map directly to left, center, and right GitHub-Flavored Markdown divider syntax, while literal pipe characters inside cells escape cleanly. Preformatted code blocks read language-* or lang-* classes and automatically switch to tilde fences if code contains triple backticks.

Does pasting HTML into the box run embedded scripts or styles?

No. Pasting into Rich paste target intercepts the clipboard string in memory and parses it with a pure TypeScript tokenizer inside a Web Worker. Script, style, noscript, template, svg, iframe, and object blocks are discarded without ever mounting nodes into the browser DOM.

What happens when Strip nav & footer is checked on a saved web page?

Enabling Strip nav & footer locates the primary main or article element first when present and skips nav, footer, and aside blocks across the document. That removes site menus, sidebars, and copyright footers before generating headings and body paragraphs.

Can I convert saved .htm or .xhtml files larger than a clipboard paste?

Yes. Drop any local .html, .htm, or .xhtml file onto the drop zone to decode its full UTF-8 source inside the worker thread without network transfers. For large AI retrieval pipelines, you can check exact token budgets right after exporting.

Updated