HTML → Markdown

Strip the chrome, keep the article. Typically 80–90% fewer tokens than raw HTML.

POST /api/v1/html-to-markdown MCP html_to_markdown convertfree

Free unless you set `render: true` (browser) or `engine: cloudflare` (AI).

Playground

HTML source to convert. Takes precedence over url.
Fetch this page and convert it.
User-agent persona. Many sites serve different HTML per persona — googlebot often returns the pre-rendered version.
Advanced options (6)
Base for resolving relative links when you pass html directly.
native = built-in streaming converter. cloudflare = Workers AI toMarkdown.
Truncate the Markdown to this many characters. 0 = no limit.
Hard timeout for the page load, in milliseconds.
Raw UA string, used only when userAgent is custom.
Runs against this deployment's live API.

Result

Fill in the form and hit Run.

Call it from code

How it works

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.

Parameters

ParameterTypeDefaultDescription
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 ![alt](src) 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.

Response

Markdown plus page metadata and a compression report.

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

Pairs well with