Mdream: HTML to Markdown Converter for LLMs

# mdream

Parse <html> with half the tokens. Zero-dependency HTML to Markdown for LLMs; fastest in JS and Rust, streaming, runs everywhere.

10kBgzip

37xfaster than Turndown

2xfewer tokens

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

URL

HTML

Convert

Protip: use `mdream.dev/<url>` to instantly get the markdown of any site

Filters

## Tools

[llms.txt Explorer·Browse, validate, and generate llms.txt files.](https://mdream.dev/llms-txt) [llms.txt Generator·Crawl any site, generate a spec-compliant llms.txt. Free.](https://mdream.dev/tools/llms-txt/generator) [llms.txt Validator·Check your llms.txt against the official spec.](https://mdream.dev/tools/llms-txt/validator) [llms.txt Guide·What is llms.txt and how to implement it.](https://mdream.dev/llms-txt/guide) [Converter Comparison·Feature and speed comparison of HTML to Markdown converters.](https://mdream.dev/tools/compare) [Live Benchmarks·Run HTML-to-Markdown benchmarks in your browser.](https://mdream.dev/tools/benchmarks) [Token Counter·Count tokens for ChatGPT, Claude, Gemini, and Llama.](https://mdream.dev/tools/token-counter) [Accept-header Tester·Replay agent requests; see what Claude Code gets back.](https://mdream.dev/tools/accept-header) [AI Visibility Audit·Check your site for ChatGPT, Claude, Perplexity readiness.](https://mdream.dev/tools/ai-audit) [Guides·GEO, AEO, markdown for agents, and AI crawler policy.](https://mdream.dev/guides)

## What is Mdream?

A zero-dependency, LLM-optimized HTML to Markdown converter. Faster and leaner than Turndown, node-html-markdown, and html-to-markdown, with output tuned for token efficiency and readability.

[<h3>#1 Fastest</h3>Up to 37x faster than Turndown (rust vs JS), 5x faster than htmd (Rust). 1.8MB HTML in ~57ms JS / ~5.2ms Rust.](https://mdream.dev/benchmarks)

### #1 Token Optimizer

Up to 2x fewer tokens than Turndown, node-html-markdown, and html-to-markdown. 70-99% fewer than raw HTML.

### Streaming

Memory efficient streaming for large documents and real-time pipelines.

### Tiny & Universal

10kB gzip JS core, 60kB with Rust WASM. Zero dependencies. Runs everywhere.

## Packages

[mdream Rust NAPI engine + WASM for edge. Includes CLI.](https://github.com/harlan-zw/mdream/tree/main/packages/mdream) [@mdream/js Pure JS engine. Full hook access, zero native deps.](https://github.com/harlan-zw/mdream/tree/main/packages/js) [@mdream/crawl Site-wide crawler to generate llms.txt artifacts](https://github.com/harlan-zw/mdream/tree/main/packages/crawl) [@mdream/vite Auto .md generation for Vite sites](https://github.com/harlan-zw/mdream/tree/main/packages/vite) [@mdream/nuxt Automatic .md and llms.txt for Nuxt sites](https://github.com/harlan-zw/mdream/tree/main/packages/nuxt) [@mdream/action GitHub Action for .md and llms.txt from static HTML](https://github.com/harlan-zw/mdream/tree/main/packages/action) [Docker Pre-built image with Playwright Chrome for crawling](https://github.com/harlan-zw/mdream/tree/main/packages/docker) [mdream (crate) Native Rust crate with CLI. Zero deps, streaming.](https://github.com/harlan-zw/mdream/tree/main/crates) [Browser CDN Use via unpkg/jsDelivr with no build step](https://github.com/harlan-zw/mdream#browser-cdn)

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