Markdown for Agents Now Available
Cloudflare has launched Markdown for Agents, a new feature that automatically converts HTML pages to markdown format when AI systems and agents request them. The conversion happens in real-time at Cloudflare's edge network for enabled zones, eliminating the need for agents to parse unstructured HTML or perform client-side conversion.
How It Works
AI agents and crawlers can request markdown versions of pages by including the Accept: text/markdown header in their HTTP requests. Cloudflare detects this preference, fetches the original HTML from the origin, converts it to markdown, and serves it back to the client. The service also returns an x-markdown-tokens header indicating the token count of the converted markdown, helping agents estimate context window usage and chunking strategy.
Key Benefits
- Massive token savings: The example blog post tested reduces from 16,180 tokens in HTML to just 3,150 in markdown—an 80% reduction
- Simplified parsing: Markdown's explicit structure is naturally suited for AI processing, eliminating intent analysis and conversion overhead
- Content signal support: Responses include
Content-Signalheaders indicating content can be used for AI training, search results, and agent input - Zero developer friction: Works out-of-the-box for any site on Cloudflare; no configuration required to support markdown requests
Getting Started
Developers building AI agents can request markdown versions using standard HTTP content negotiation:
const r = await fetch('https://example.com/page', {
headers: { Accept: 'text/markdown, text/html' }
});
const tokenCount = r.headers.get('x-markdown-tokens');
const markdown = await r.text();
Cloudflare has already enabled the feature on its developer documentation and blog. Popular coding agents like Claude Code and OpenCode already send these Accept headers—they'll now receive optimized markdown responses automatically.
Future Roadmap
Cloudflare plans to offer custom Content Signal policies in future updates, allowing site owners to define granular permissions for how their content can be used by different types of AI systems.