HTML to Markdown Converters Compared · Mdream

[Home](https://mdream.dev/tools/compare/)

# HTML to Markdown Converters Compared

How does mdream stack up against [Turndown](https://github.com/mixmark-io/turndown), [node-html-markdown](https://github.com/crosstype/node-html-markdown), and [html-to-markdown](https://github.com/johanneskaufmann/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 ](https://mdream.dev/tools/compare/tools/benchmarks)

## Feature Comparison

| Feature | mdream | Turndown | node-html-markdown | html-to-markdown (Go) |
| --- | --- | --- | --- | --- |
| Language | Rust + JS + WASM | JavaScript | JavaScript | Go |
| Speed (166KB) | 0.34ms (Rust), 3.26ms (JS) | 11.26ms | 14.31ms | ~2ms |
| Token Output | Lowest | High | High | Medium |
| Bundle Size | 10kB (JS), 60kB (WASM) | ~30kB | ~25kB | Go binary |
| Streaming |  |  |  | |
| Dependencies | 0 | 1 | 3 | 0 |
| 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.

[GitHub](https://github.com/harlan-zw/mdream) [ npm](https://npmx.dev/package/mdream)

## 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](https://github.com/mixmark-io/turndown). 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

What is the fastest HTML to Markdown converter?

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).

What is the best alternative to Turndown?

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.

Which HTML to Markdown converter produces the fewest tokens?

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.

Can I use mdream as a drop-in replacement for Turndown?

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.

Which converter works best for LLM and AI pipelines?

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.

Does mdream work in the browser?

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

[<h3>Online Converter</h3>Convert HTML to Markdown in your browser.](https://mdream.dev/tools/compare/) [<h3>Live Benchmarks</h3>Run speed tests in your own browser.](https://mdream.dev/tools/compare/tools/benchmarks)

© 2026 [Harlan Wilton](https://github.com/harlan-zw) · [MIT](https://github.com/harlan-zw/mdream/blob/main/license)

[GitHub](https://github.com/harlan-zw/mdream) [Discord](https://discord.com/invite/275MBUBvgP)