HTML to Markdown Converter Online — Free HTML to MD

HTML to Markdown

Convert HTML to Markdown with support for GFM, CommonMark, and Obsidian syntax.

Free online HTML to Markdown converter that transforms complex HTML markup, web articles, rich text, and CMS exports into clean, portable Markdown. Supports GitHub Flavored Markdown (GFM) with pipe tables, task lists, and strikethrough, standard CommonMark, and Obsidian wiki links. Features configurable formatting options including fenced or indented code blocks, ATX or Setext headings, custom bullet markers, and image stripping for LLM prompt token reduction and RAG indexing. Real-time conversion statistics display heading counts, table structures, link ratios, and byte reduction metrics. Operates 100% client-side for total privacy with zero server uploads.

Keywords: html to markdown, html to md, html to markdown converter, convert html to markdown, html to gfm, html to commonmark, html to obsidian, html markdown converter, html to markdown online, free html to markdown, turndown, markdownify, html to md converter, convert html to md, html table to markdown, html to markdown table converter, clean html for llm, html to markdown rag, rich text to markdown, webpage to markdown, html to markdown code blocks, html to obsidian wiki links, html to markdown python alternative, html2text online, rehype to remark converter

Tags: html, markdown, convert, gfm, commonmark, obsidian, converter

Browse all 21 Web Code tools →

HTML to Markdown is also known as: HTML to Markdown Converter Online, HTML to MD Converter, HTML to GFM Converter, HTML to CommonMark Converter, HTML to Obsidian Converter, Turndown HTML to Markdown, HTML to Markdown Table Converter, Clean HTML to Markdown for LLM, Webpage to Markdown Converter, Rich Text to Markdown Converter.

How to HTML to Markdown Online

  1. Paste your raw HTML markup into the input editor on the left, or upload a local .html document file.

  2. Select your target Markdown specification: GitHub Flavored Markdown (GFM) for tables and task lists, CommonMark for universal portability, or Obsidian Wiki Links for PKM vaults.

  3. Configure transformation options: customize code block style (fenced ``` vs indented 4-space), heading format (ATX # vs Setext ===), and list bullet characters (-, *, +).

  4. Tune optimization filters: toggle "Remove Images" to minimize prompt tokens for LLM context windows or "Keep HTML" to retain complex inline tags.

  5. Click "Convert HTML" or press ⌘↵ (Ctrl+Enter) to transform your HTML AST into clean Markdown in real time.

  6. Examine real-time conversion statistics to evaluate heading depth, link counts, table matrix structure, and overall byte/token size reduction percentage.

  7. Copy the clean Markdown output (⌘⇧C), download as a .md file, or generate a compressed URL parameter to share the transformation with teammates.

HTML to Markdown Features

  • Unified AST Conversion Pipeline: Powered by rehype and remark Abstract Syntax Trees (AST) for resilient, spec-compliant HTML-to-Markdown parsing.

  • 3 Target Markdown Dialects: Seamlessly switch between GitHub Flavored Markdown (GFM), strict CommonMark, and Obsidian [[Wiki Links]].

  • GFM Pipe Table Extraction: Converts HTML <table>, <thead>, <tbody>, <tr>, <th>, and <td> structures into clean Markdown tables with column alignments (:---:, ---:).

  • Syntax-Highlighted Code Blocks: Automatically parses <pre><code class="language-*"> and extracts language hints into fenced ```language code blocks.

  • ATX & Setext Heading Formatting: Converts h1–h6 tags into structured # ATX headings or configurable Setext underline syntax, maintaining document outline hierarchy.

  • LLM & RAG Token Minimization: Strips noisy DOM wrappers (<div>, <section>, inline styles, class attributes) to reduce token consumption by 60–80% for embedding models.

  • Configurable List Markers: Preserves nested ordered (<ol>) and unordered (<ul>) list hierarchies with configurable bullet markers (-, *, +).

  • Task List & Checkbox Support: Transforms <input type="checkbox"> items into interactive GFM task lists (- [ ] and - [x]).

  • Strikethrough & Formatting Presets: Converts <del>, <s>, and <strike> tags into GFM ~~strikethrough~~ syntax while retaining bold (<strong>) and italic (<em>) emphasis.

  • Semantic Blockquote Handling: Transforms <blockquote> tags into nested Markdown > quotation blocks with proper whitespace indenting.

  • Selective Image Stripping: Strip <img> tags completely to create lightweight text-only corpora for prompt engineering and LLM training data.

  • Obsidian Vault Cross-Linking: Translates relative hyperlinks and anchor tags into native Obsidian [[note-title|Anchor Text]] internal references.

  • XSS Sanitization & Safety: Employs strict rehype-sanitize AST filtering to neutralize malicious <script> injections and dangerous DOM attributes before conversion.

  • Real-Time Conversion Metrics: Live telemetry reporting input/output bytes, byte reduction percentage, total headings, links, code blocks, tables, and lists.

  • Compressed URL Sharing: Compresses source HTML into stateless base64 URL hash fragments for zero-backend sharing with collaborators.

  • 100% Client-Side Execution: All parsing and string generation execute in browser memory — no HTML documents or proprietary content ever reach a server.

  • Keyboard Hotkeys for Power Users: Rapid workflow acceleration with ⌘↵ (Convert), ⌘⇧C (Copy output), and ⌘⇧K (Clear editor).

Supported Formats & Dialects

The HTML to Markdown supports 6 syntax formats and dialects for accurate parsing and processing.

GitHub Flavored Markdown (GFM Spec v0.29-gfm)
The de facto developer standard extending CommonMark with pipe tables (| col |), task lists (- [x]), autolinks, and strikethrough (~~deleted~~) supported across GitHub, GitLab, and developer tools.
Standard CommonMark Specification (Spec v0.31.2)
The formal, unambiguous Markdown specification ensuring predictable rendering across static site generators, document linters, and publishing engines without proprietary syntax extensions.
Obsidian & PKM Wiki Links ([[Note#Heading|Label]])
Bidirectional note linking syntax designed for personal knowledge management (PKM) tools like Obsidian, Logseq, and Foam, converting relative HTML paths into internal vault wikilinks.
Unified Rehype & Remark AST Transformation Pipeline
Standard unist Abstract Syntax Tree (AST) architecture parsing HTML into HAST (HTML AST), sanitizing nodes, mapping to MDAST (Markdown AST), and stringifying clean plain-text markdown.
HTML Table to Pipe Matrix Conversion
Structured tabular data extraction transforming <table>, <thead>, and <tr> elements into aligned Markdown pipe grids with header separator rows and column alignment delimiters (:---:, :---, ---:).
LLM & RAG Semantic Token Optimization
DOM flattening and boilerplate removal tailored for Retrieval-Augmented Generation (RAG) pipelines, stripping HTML tag noise to cut vector embedding and LLM prompt token costs by up to 80%.
All Guides
All Standards

Pre-built Automation Pipelines

Chain HTML to Markdown with other utilities in a multi-step visual workflow.

beginner
text-processing

HTML to Clean Markdown

Convert HTML to markdown and normalize text case.

Flow:
InputHTML to MarkdownText Case ConverterOutput
4 nodes
beginner
text-processing

Preview & Clean Markdown

Preview markdown and convert back to clean text.

Flow:
InputMarkdown PreviewHTML to MarkdownOutput
4 nodes

Frequently Asked Questions

How does DevFlow convert HTML tables into GFM Markdown tables with column alignment?
The converter inspects the HTML AST for <table> elements, separating <thead> header rows from <tbody> data rows. It extracts text nodes from <th> and <td> cells, determines column count, and generates a delimiter row (| --- | --- |). If HTML alignment attributes (align="center" or align="right") or inline text-align CSS styles are present, the converter maps them to Markdown column alignment colons (:---: or ---:).
How does HTML to Markdown conversion reduce token consumption in LLM and RAG pipelines?
Raw web HTML is heavily bloated with structural wrappers (<div>, <nav>, <section>), CSS utility classes, data-* attributes, and script tags that routinely account for 70% to 85% of total document tokens. By converting HTML to concise Markdown, you eliminate tag overhead while preserving critical semantic hierarchy (headings, tables, lists, and code blocks). This cuts LLM prompt token costs, improves retrieval accuracy in vector databases (like Pinecone, Qdrant, or Chroma), and fits more context into LLM windows.
What is the difference between CommonMark, GitHub Flavored Markdown (GFM), and Obsidian wiki links?
CommonMark is the foundational, standardized specification that guarantees consistent parsing across all compliant renderers. GitHub Flavored Markdown (GFM) is a strict superset of CommonMark that adds pipe tables, task lists (- [x]), autolinks, and strikethrough. Obsidian mode builds on GFM by transforming internal relative URLs (e.g., <a href="/docs/setup">Setup</a>) into Obsidian-style bidirectional wikilinks ([[docs/setup|Setup]]), enabling direct import into personal knowledge bases.
How does the converter handle code blocks and syntax highlighting language tags?
When encountering <pre><code class="language-typescript"> blocks, the parser extracts the CSS language class identifier (e.g., "typescript", "python", "html", or "json") and emits a fenced Markdown code block: ```typescript ... ```. When the code element lacks a language class, it emits a standard fenced block or 4-space indented block based on your selected code block style setting.
How are nested lists, mixed ordered/unordered lists, and task checkboxes converted?
The AST processor traverses nested <ul> and <ol> trees recursively. It calculates tree depth and indents child list items by 2 or 4 spaces relative to their parent element. Ordered lists retain numerical markers (1., 2.), unordered lists use your chosen bullet character (-, *, or +), and list items containing <input type="checkbox"> tags are converted to GFM interactive task lists (- [ ] or - [x]).
What happens to unsupported or complex HTML tags during conversion?
When the "Keep HTML" option is enabled, non-standard elements (such as <details>, <summary>, <video>, or embedded <iframe> elements) are passed through into the Markdown document as raw inline HTML, which most modern Markdown parsers (like MDX, GitHub, and Hugo) render natively. When "Keep HTML" is disabled, the parser strips non-semantic tags while safely extracting their internal text content.
How does the "Remove Images" option assist in dataset preparation and prompt engineering?
In many Retrieval-Augmented Generation (RAG) applications, documentation indexers, and natural language processing tasks, image tags (![alt](url)) add irrelevant URL noise that consumes tokens without adding textual value. Enabling the "Remove Images" toggle strips all <img> tags and Markdown image references from the output, producing a pure text corpus optimized for LLM tokenization.
What is the difference between ATX headings and Setext headings in Markdown output?
ATX headings use prefix hashes (# Heading 1, ## Heading 2, etc.) up to level 6, which is the modern standard for readability and flexibility. Setext headings underline level 1 and level 2 headings with equals signs (Heading 1\n===) or hyphens (Heading 2\n---). DevFlow defaults to ATX headings but lets you select Setext formatting if your style guide or static site generator requires it.
How does the converter protect against Cross-Site Scripting (XSS) in untrusted HTML?
DevFlow incorporates rehype-sanitize into its parsing pipeline. The sanitizer evaluates all incoming HTML nodes against a strict HTML5 schema, stripping active script tags (<script>), event handler attributes (onclick, onload), embedded executable objects, and unsafe URI protocols (javascript:) before converting elements to Markdown. This ensures safe handling of untrusted third-party web content.
Can this tool process complete HTML web documents as well as HTML fragments?
Yes. The parser automatically detects whether your input is a complete HTML5 document (containing <!DOCTYPE html>, <html>, <head>, and <body>) or an isolated HTML fragment (such as rich text from a CMS or clipboard). When given a full document, it automatically discards <head> metadata, scripts, and stylesheet links, converting only the substantive body content.
How does Obsidian Wiki Link mode transform internal relative URLs and anchors?
In Obsidian mode, standard anchor tags linking to local paths (e.g., <a href="/architecture/database-schema">Architecture</a>) or page section anchors (<a href="#migration-steps">Steps</a>) are converted into Obsidian bidirectional wiki links: [[architecture/database-schema|Architecture]] or [[#migration-steps|Steps]]. External hyperlinks with http:// or https:// protocols remain standard Markdown links ([Title](https://...)).
Is my HTML content sent to an external server or stored anywhere?
No. The DevFlow HTML to Markdown Converter executes 100% client-side in your web browser using JavaScript and Web Workers. No source HTML markup, converted Markdown text, URLs, or document statistics are ever transmitted over the network or saved to remote databases, making it completely safe for proprietary documentation, internal wikis, and confidential code.

Developer Reference & Learning Hubs