Strip the chrome, keep the article. Typically 80–90% fewer tokens than raw HTML.
html_to_markdown
convertfree
Free unless you set `render: true` (browser) or `engine: cloudflare` (AI).
The workhorse for feeding web pages to a language model.
A streaming HTMLRewriter pipeline drops <script>, <style>, navigation, headers, footers, sidebars,
cookie banners and comment sections, then emits clean Markdown — headings, lists, tables, code blocks, links
and images survive.
Because it streams, it costs a couple of milliseconds of CPU even on large pages, and it consumes no AI
quota at all. Set engine: "cloudflare" to route through Workers AI's toMarkdown instead if you prefer
their heuristics.
| Parameter | Type | Default | Description |
|---|---|---|---|
| url | string | — | Fetch this page and convert it. |
| html | string | — | HTML source to convert. Takes precedence over url. |
| readability | boolean | true |
Keep only the main article region and drop nav/aside/footer boilerplate. |
| compact | boolean | true |
Collapse repeated blank lines and whitespace runs. Saves another ~5% of tokens. |
| includeLinks | boolean | true |
Keep [text](href) links. Turn off to shed a lot of tokens. |
| includeImages | boolean | true |
Keep  images. |
| render | boolean | false |
Load the URL in Chromium first (for SPAs). Consumes browser minutes. |
| engine | `native` | `cloudflare` | "native" |
native = built-in streaming converter. cloudflare = Workers AI toMarkdown. |
| baseUrl | string | — | Base for resolving relative links when you pass html directly. |
| maxLength | integer | 0 |
Truncate the Markdown to this many characters. 0 = no limit. |
| userAgent | `chrome-desktop` | `chrome-android` | `safari-iphone` | `googlebot` | `bingbot` | `curl` | `custom` | "chrome-desktop" |
User-agent persona. Many sites serve different HTML per persona — googlebot often returns the pre-rendered version. |
| userAgentString | string | — | Raw UA string, used only when userAgent is custom. |
| timeoutMs | integer | 20000 |
Hard timeout for the page load, in milliseconds. |
Markdown plus page metadata and a compression report.
| Parameter | Type | Default | Description |
|---|---|---|---|
| markdown | string | — | The converted document. |
| title | string | — | Document title. |
| meta | object | — | description, canonical, OpenGraph… |
| stats | object | — | {htmlChars, markdownChars, ratio, approxTokens}. |
| truncated | boolean | — | True when maxLength cut the output. |