Home

HTML to Markdown Converters Compared

How does mdream stack up against Turndown, node-html-markdown, and html-to-markdown? Speed benchmarks, token output, and features at a glance.

Speed Benchmarks

166 KB HTML · lower is better
mdream (Rust)
0.34ms
mdream (NAPI)
0.52ms
mdream (JS)
3.26ms
Turndown (JS)
11.26ms
node-html-md (JS)
14.31ms
Run live benchmarks in your browser

Feature Comparison

Feature mdreamTurndownnode-html-markdownhtml-to-markdown (Go)
Language Rust + JS + WASMJavaScriptJavaScriptGo
Speed (166KB) 0.34ms (Rust), 3.26ms (JS)11.26ms14.31ms~2ms
Token Output LowestHighHighMedium
Bundle Size 10kB (JS), 60kB (WASM)~30kB~25kBGo binary
Streaming
Dependencies 0130
Maintained

mdream

The fastest HTML to Markdown converter in any runtime. Built in Rust with bindings for Node.js (NAPI), browsers (WASM), and a pure JavaScript fallback. Designed for LLM pipelines where token efficiency and speed matter.

Turndown

The most popular HTML to Markdown converter for JavaScript. Turndown has a clean plugin API and good browser support, but is no longer actively maintained. At 11.26ms for 166KB HTML, it is 3.5x slower than mdream's JS engine and produces roughly 2x more tokens.

node-html-markdown

A Node.js focused converter with custom translation rules. Actively maintained but the slowest JavaScript option at 14.31ms for 166KB HTML. Produces similar token counts to Turndown. Best suited for Node.js projects that need custom element handling.

html-to-markdown (Go)

A well-regarded Go implementation by Johannes Kaufmann. Fast at ~2ms, good structure preservation, but only available as a Go module. If your stack is Go, this is a solid choice alongside mdream's Rust crate.

Frequently Asked Questions

mdream is the fastest HTML to Markdown converter across all runtimes. The Rust implementation processes 166KB of HTML in 0.34ms. The pure JavaScript version runs at 3.26ms, still 3.5x faster than Turndown (11.26ms) and 4.4x faster than node-html-markdown (14.31ms).

mdream is the recommended Turndown alternative. It produces 2x fewer tokens (important for LLM pipelines), is 3.5x faster in JavaScript and 33x faster in Rust, has zero dependencies versus Turndown's one, and supports streaming for large documents. Turndown is no longer actively maintained.

mdream produces the fewest tokens of any HTML to Markdown converter. In benchmarks, mdream output uses roughly half the tokens of Turndown, node-html-markdown, and html-to-markdown for the same input. This matters for LLM context windows where every token counts.

mdream has a different API than Turndown, but covers the same use cases. Migration is straightforward: replace the Turndown import with mdream, pass your HTML string, and get Markdown back. mdream also supports options like minimal mode, table handling, and custom element filtering.

mdream is designed specifically for LLM pipelines. It strips unnecessary whitespace, removes redundant formatting, and produces token-efficient Markdown. It also supports streaming for processing large documents without loading everything into memory, and includes a crawler for generating llms.txt files.

Yes. mdream runs everywhere: Node.js (via Rust NAPI), browsers (via WASM or pure JS), edge runtimes (Cloudflare Workers, Deno, Bun), and as a Rust crate. The pure JS bundle is 10kB gzipped with zero dependencies.

Try It