01What it does, and why you need it.
When a request arrives with the header Accept: text/markdown, Cloudflare fetches your HTML, strips navigation, scripts and styling, and returns clean Markdown with the page metadata and any structured data intact, plus a token count.
LLMs pay for each token read, and HTML is mostly tokens they do not need. Cloudflare says the conversion cuts token use by up to 80%. On a paid Cloudflare plan it costs nothing extra to switch on.
02Who should deal with this.
Whoever administers your Cloudflare account. It is a toggle in the dashboard or 1 API call, so the work is minutes. Two decisions need an owner beyond that. First, whether to enable it for the whole zone or only certain paths. Second, what usage policy to signal: by default the converted response tells AI systems they may use the content for training, search and AI input, unless your origin already sets its own content-signal header. That second point belongs with whoever owns your content licensing position, not with the person who flips the switch.
Level of importance
Low effort, moderate value for any content-heavy site on Cloudflare. Not applicable if your site is not on Cloudflare, though the same idea can be built yourself.
03Where it comes from.
Cloudflare launched Markdown for Agents in Feb. 2026. The reasoning, in Cloudflare’s own words, is that Markdown has quickly become the lingua franca for agents and AI systems as a whole, and its explicit structure makes it ideal for AI processing while minimising token waste. A typical web page carries divs, scripts and other markup that an LLM has to read and pay for but does not need.
Cloudflare has enabled the feature on its own developer documentation and blog. It has also said that popular coding agents such as Claude Code and OpenCode already send the relevant header, so existing tools benefit without changes.
04How it works: content negotiation.
The feature uses standard HTTP content negotiation, the same mechanism a browser uses to say it prefers one image format over another. A client that wants Markdown sends:
Request header
Accept: text/markdown
For a zone with the feature enabled, Cloudflare detects the header, fetches the original HTML from your origin server, converts it and serves the Markdown instead. A browser sending a normal Accept header gets the HTML as before. Nothing changes on your origin.
You can test it against Cloudflare’s own blog:
Test
curl https://blog.cloudflare.com/markdown-for-agents/ \ -H "Accept: text/markdown"
05What the response looks like.
Cloudflare documents this example response:
Example response
HTTP/2 200 content-type: text/markdown; charset=utf-8 vary: accept cache-control: public, max-age=3600 x-markdown-tokens: 725 x-original-tokens: 12345 content-signal: ai-train=yes, search=yes, ai-input=yes --- title: Markdown for Agents · Cloudflare Agents docs --- ## What is Markdown for Agents Markdown has quickly become the lingua franca for agents and AI systems as a whole. ...
The body always follows the same layout, so an AI system does not need per-site parsing logic:
1 · Frontmatter
YAML frontmatter with title, description and image taken from the page’s meta tags. Standard meta tags take priority, with Open Graph tags as fallback. Emitted only when at least 1 supported tag exists.
2 · Body
The body converted to Markdown. Headers, footers, navigation, scripts and styles are stripped.
3 · Structured data
Any JSON-LD structured data from the page, preserved as a fenced json block at the end. This is the only script content kept.
Headers worth knowing:
x-markdown-tokens
The estimated token count of the Markdown document.
x-original-tokens
The estimated token count of the original HTML.
content-signal
The usage permissions attached to the content (see below).
vary: accept
Added so caches keep the HTML and Markdown versions separate.
Security and cache headers from your origin such as Strict-Transport-Security, Content-Security-Policy, Set-Cookie and CORS headers are preserved. ETag and Last-Modified are dropped because conditional requests cannot be honoured for a converted body.
06Content Signals.
Content Signals is a framework, at contentsignals.org, for expressing how content may be used after it has been accessed. If your origin already sets a content-signal header, Cloudflare preserves it on the converted response; your origin’s policy is authoritative. If it does not, Cloudflare adds a default:
Default header
Content-Signal: ai-train=yes, search=yes, ai-input=yes
This signals that the content may be used for AI training, search results and AI input, which includes agentic use. If that is not your policy, set the header at your origin before enabling the feature.
07How to enable it.
Dashboard, whole zone
Log in to the Cloudflare dashboard and select your account. A Pro or Business plan is required. Select the zone. Go to the AI Crawl Control section. Enable Markdown for Agents.
Specific subdomains or paths
Create a Configuration Rule. Go to Rules > Overview > Create rule > Configuration Rules. Under “When incoming requests match”, build an expression such as http.host eq "docs.example.com" or starts_with(http.request.uri.path, "/blog/"). Under “Then the settings are”, select Add setting > Markdown for Agents and set it to On. Deploy.
By API
Zone-wide, or path-scoped as a configuration rule, as below. The API token needs Zone Settings edit permission.
Zone-wide:
API, zone-wide
curl -X PATCH 'https://api.cloudflare.com/client/v4/zones/{zone_tag}/settings/content_converter' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer {api_token}" \
--data-raw '{"value": "on"}'Path-scoped, as a configuration rule:
API, path-scoped
curl --request PUT \
--url "https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/phases/http_config_settings/entrypoint" \
--header "Authorization: Bearer {api_token}" \
--header "Content-Type: application/json" \
--data '{
"rules": [{
"expression": "http.host eq \"docs.example.com\"",
"action": "set_config",
"action_parameters": { "content_converter": true },
"description": "Enable Markdown for Agents for docs subdomain"
}]
}'Cloudflare for SaaS customers can enable it for all custom hostnames from the zone’s Quick Actions, or for specific hostnames using custom metadata plus a configuration rule; the latter requires an advanced subscription.
08Availability, pricing and limits.
Availability
Available on Pro, Business and Enterprise plans, and to SSL for SaaS customers, at no cost.
Source
Conversion is from HTML only. Other document types are not converted by this feature.
Limit
The origin response cannot exceed 2 MB (2,097,152 bytes).
09Using it from your own agent.
If you are building an agent rather than serving content, request Markdown and read the token headers to decide whether the page fits your context window or needs chunking:
TypeScript
const r = await fetch("https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/", {
headers: { Accept: "text/markdown" },
});
const tokenCount = r.headers.get("x-markdown-tokens");
const originalTokenCount = r.headers.get("x-original-tokens");
const markdown = await r.text();For pages not on Cloudflare, or not HTML, Cloudflare offers 2 other routes: the Workers AI toMarkdown() API, which handles PDFs, Word and Excel files, images, CSV and XML, and the Browser Run /markdown endpoint, which renders JavaScript-heavy pages in a real browser before converting. An open source agent skill, markdown-for-agents, chains all 3 with automatic fallback.
10If you are not on Cloudflare.
The equivalent is to serve your own Markdown variant. 2 approaches are in use:
A .md version of each page
Publish a .md version of each page at a predictable address. Cloudflare’s own agent card advertises this pattern for its marketing site as https://www.cloudflare.com/{path}.md.
Content negotiation
Implement content negotiation on your own server or CDN, returning text/markdown when the Accept header asks for it. Open source converters exist, including @markdown-for-agents/core, which runs on Node, Bun, Deno and edge runtimes and was built with this feature as its reference.
11Sources.
- 01Cloudflare’s official documentation, covering output format, headers, Content Signals, how to enable by dashboard and API, pricing and limits. developers.cloudflare.com/fundamentals/reference/markdown-for-agents/developers.cloudflare.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 02Cloudflare’s launch announcement, which is itself served as Markdown when requested with the right header. blog.cloudflare.com/markdown-for-agents/blog.cloudflare.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 03Workers AI toMarkdown() documentation for converting other document types, and the HTML pre-processing rules that Markdown for Agents shares. developers.cloudflare.com/workers-ai/features/markdown-conversion/developers.cloudflare.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 04The Browser Run /markdown endpoint for rendering JavaScript-driven pages before conversion. developers.cloudflare.com/browser-run/quick-actions/markdown-endpoint/developers.cloudflare.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 05Configuration Rules documentation, used to scope the feature to subdomains or paths. developers.cloudflare.com/rules/configuration-rules/developers.cloudflare.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 06The Content Signals framework referenced by the content-signal header. contentsignals.org/contentsignals.orgWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 07MDN’s explanation of HTTP content negotiation and the Accept header. developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Content_negotiationdeveloper.mozilla.orgWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 08The New Stack’s report on the launch, including the up to 80% token reduction figure and the note that Claude Code and OpenCode already send the header. thenewstack.io/cloudflares-markdown-for-agents-automatically-make-websites-more-aifriendly/thenewstack.ioWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 09Digiday’s explainer for publishers on why Markdown matters to AI systems and what the toggle does. digiday.com/media/wtf-is-markdown-for-ai-agents/digiday.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 10Open source agent skill that chains content negotiation, Workers AI and Browser Rendering with fallback. github.com/arsolutioner/markdown-for-agentsgithub.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 11Runtime-agnostic HTML to Markdown converter for sites not on Cloudflare, with content extraction and token estimation. jsr.io/@markdown-for-agents/corejsr.ioWe do not enable external links - please copy and paste, you are then certain as to the link being opened
- 12Cloudflare’s agent card, which advertises the {path}.md pattern for Markdown versions of its marketing pages. www.cloudflare.com/.well-known/agent.jsoncloudflare.comWe do not enable external links - please copy and paste, you are then certain as to the link being opened