AutomationNewsTools & Platforms

Cloudflare “Markdown for Agents” Explained: The New Standard for AI Agent Optimization

Learn how Cloudflare Markdown for Agents serves text/markdown via Accept headers, cuts token waste, and what limitations to plan for.

Ibuki Yamamoto
Ibuki Yamamoto
February 20, 2026 3min read

Cloudflare’s Markdown for Agents, announced on February 12, 2026, lets AI agents and crawlers request a web page as Markdown (text/markdown) instead of HTML. The key idea is simplicity: the publisher turns it on in Cloudflare, and the client just sends an Accept header indicating it prefers Markdown.

What You’ll Learn
  • How Markdown for Agents works and what it’s designed for
  • How to enable it—and example requests from the agent side
  • Operational limitations you’ll likely hit, plus practical alternatives

What did Cloudflare announce?

Cloudflare introduced Markdown for Agents, a feature that (when enabled for a Cloudflare zone) allows clients such as AI agents to send Accept: text/markdown. Cloudflare then fetches the original HTML from the origin, automatically converts it to Markdown when possible, and returns Markdown to the requester.

Cloudflare frames this as a token-efficiency and preprocessing problem: if you feed raw HTML into an LLM pipeline, you pay for navigation, wrappers, scripts, and other markup that has little semantic value. As a concrete example, Cloudflare says the blog post you’re reading takes 16,180 tokens as HTML but 3,150 tokens as Markdown—an 80% reduction.

Bottom line: by pushing HTML → Markdown conversion to the edge, agents can spend less effort on extraction/cleanup and reduce both token cost and implementation complexity.


How it works (key mechanics)

Use Accept to request the format

This is standard HTTP content negotiation. If the client includes text/markdown in the Accept header, Cloudflare retrieves the HTML from the origin and returns a Markdown representation when conversion is supported. The response includes Vary: accept, signaling that caches should treat HTML vs. Markdown as different variants.

x-markdown-tokens

Converted responses include an x-markdown-tokens header containing an estimated token count for the Markdown body. In agent implementations, this is useful for context-window budgeting and deciding chunk sizes before you do any downstream processing.

Content-Signal header

Cloudflare’s documentation notes that, by default, converted responses include Content-Signal: ai-train=yes, search=yes, ai-input=yes. This is part of the broader Content Signals approach—an HTTP-level way to communicate preferences about how content may be used after access (with mention of future custom policy options).


How to use it

Try it with curl

If Markdown for Agents is enabled on the target zone, request Markdown like this:

curl https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/ \
  -H "Accept: text/markdown"

Implement it with fetch

The client-side logic is equally simple in Workers or any HTTP client—just send an Accept header (conceptual example below):

const r = await fetch("https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/", {
  headers: {
    Accept: "text/markdown, text/html",
  },
});

const tokenCount = r.headers.get("x-markdown-tokens");
const markdown = await r.text();

Note: This only works if the publisher has enabled Markdown for Agents on their Cloudflare zone. It’s not a universal “convert any site on demand” switch—it’s negotiation with sites that have opted in.


How to enable it

Dashboard

Cloudflare’s docs describe enabling this per zone in the Cloudflare dashboard (plan requirements apply). In practice, you select the zone and toggle the Markdown for Agents setting within the relevant AI/Crawler controls area (Cloudflare also highlights Quick Actions in its documentation).

Enable via API

Via the API, you patch the zone setting at /client/v4/zones/{zone_tag}/settings/content_converter with {"value": "on"}:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/{zone_tag}/settings/content_converter" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {api_token}" \
  --data-raw '{"value": "on"}'

Pricing note: Cloudflare states the feature is available at no extra cost for Pro, Business, and Enterprise plans, and also for SSL for SaaS customers.


Limitations and operational gotchas

HTML only (for now)

Per Cloudflare’s current limitations, conversion is limited to HTML → Markdown. Don’t assume the same mechanism will convert PDFs or Office documents.

No compressed origin responses

Cloudflare explicitly notes that it doesn’t support compressed responses from the origin for this conversion flow. Depending on how your origin is configured, this can be a surprising reason the feature doesn’t behave as expected.

Zone-level setting

This is configured at the zone level. If you need different behavior per subdomain, Cloudflare’s guidance is to split them into separate zones.

Alternatives (and when to use them)

Cloudflare also points to other options for broader “document-to-Markdown” needs. In practice, you’ll pick based on whether you control the zone, what formats you need, and whether you must render JavaScript-heavy pages.

Option Best for Strengths Trade-offs
Markdown for Agents HTML from zones where the publisher enabled it Just send Accept; conversion happens at the edge Requires publisher opt-in; has clear limitations
Workers AI toMarkdown Multiple file formats (conversion utility) Works for documents outside Cloudflare zones; supports many formats You need to integrate an API; costs can vary by use case
Browser Rendering /markdown Dynamic pages that require real rendering Converts after browser rendering, which helps with JS-heavy sites Higher latency and compute cost due to rendering


Practical use cases

Reduce agent-side preprocessing

Many scraping/agent pipelines end up doing: HTML fetch → main-content extraction → HTML-to-Markdown conversion → chunking. Markdown for Agents offloads the conversion step to the delivery layer, which can simplify your implementation and reduce token waste.

Monitoring and visibility

Cloudflare also notes that Cloudflare Radar can help visualize content types returned to AI bots/crawlers. Operationally, this makes it easier to answer: “Are agents actually consuming our Markdown variant, and how often?”


Summary

Cloudflare’s Markdown for Agents uses Accept: text/markdown to trigger on-the-fly conversion from HTML to Markdown at the edge. Done right, it reduces token waste and removes a common preprocessing step from agent pipelines. The trade-off is that it only works for zones where the publisher enabled it—and today it’s limited to HTML, doesn’t support compressed origin responses, and is configured per zone. If your site is already on Cloudflare, enabling it on a target zone and validating real agent requests is a practical first step.

About the Author

Ibuki Yamamoto
Ibuki Yamamoto

Web scraping engineer with over 10 years of practical experience, having worked on numerous large-scale data collection projects. Specializes in Python and JavaScript, sharing practical scraping techniques in technical blogs.

Leave it to the
Data Collection Professionals

Our professional team with over 100 million data collection records annually solves all challenges including large-scale scraping and anti-bot measures.

100M+
Annual Data Collection
24/7
Uptime
High Quality
Data Quality