Introducing Markdown for Agents

Thursday, February 12, 2026 AI
Read original

Scraped Article

# Introducing Markdown for Agents 2026-02-12 - [![Celso Martinho](https://blog.cloudflare.com/cdn-cgi/image/format=auto,dpr=3,width=64,height=64,gravity=face,fit=crop,zoom=0.5/https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2pzgat1zmt1oF1byi7hskH/7b25e8e00117ee44afe36ad27d7d8032/celso.png)](https://blog.cloudflare.com/author/celso/) [Celso Martinho](https://blog.cloudflare.com/author/celso/) - [![Will Allen](https://blog.cloudflare.com/cdn-cgi/image/format=auto,dpr=3,width=64,height=64,gravity=face,fit=crop,zoom=0.5/https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4EllgD62XLR1z6DEJVpVpu/e2841e9cea806330f4910c9ceedeec11/DSC_3850-H_Edited.jpg)](https://blog.cloudflare.com/author/will-allen/) [Will Allen](https://blog.cloudflare.com/author/will-allen/) 5 min read This post is also available in [简体中文](https://blog.cloudflare.com/zh-cn/markdown-for-agents), [日本語](https://blog.cloudflare.com/ja-jp/markdown-for-agents), [한국어](https://blog.cloudflare.com/ko-kr/markdown-for-agents) and [繁體中文](https://blog.cloudflare.com/zh-tw/markdown-for-agents). ![](https://cf-assets.www.cloudflare.com/zkvhlag99gkb/rzmAhLxuiqzCffB9yZrdf/91858defbc03196c5f074a26117248f9/BLOG-3162_1.png) The way content and businesses are discovered online is changing rapidly. In the past, traffic originated from traditional search engines, and SEO determined who got found first. Now the traffic is increasingly coming from AI crawlers and agents that demand structured data within the often-unstructured Web that was built for humans. As a business, to continue to stay ahead, now is the time to consider not just human visitors, or traditional wisdom for SEO-optimization, but start to treat agents as first-class citizens. ## Why markdown is important Feeding raw HTML to an AI is like paying by the word to read packaging instead of the letter inside. A simple `## About Us` on a page in markdown costs roughly 3 tokens; its HTML equivalent – `<h2 class="section-title" id="about">About Us</h2>` – burns 12-15, and that's before you account for the `<div>` wrappers, nav bars, and script tags that pad every real web page and have zero semantic value. This blog post you’re reading takes 16,180 tokens in HTML and 3,150 tokens when converted to markdown. **That’s a 80% reduction in token usage**. [Markdown](https://en.wikipedia.org/wiki/Markdown) has quickly become the _lingua franca_ for agents and AI systems as a whole. The format’s explicit structure makes it ideal for AI processing, ultimately resulting in better results while minimizing token waste. The problem is that the Web is made of HTML, not markdown, and page weight has been [steadily increasing](https://almanac.httparchive.org/en/2025/page-weight#page-weight-over-time) over the years, making pages hard to parse. For agents, their goal is to filter out all non-essential elements and scan the relevant content. The conversion of HTML to markdown is now a common step for any AI pipeline. Still, this process is far from ideal: it wastes computation, adds costs and processing complexity, and above all, it may not be how the content creator intended their content to be used in the first place. What if AI agents could bypass the complexities of intent analysis and document conversion, and instead receive structured markdown directly from the source? ## Convert HTML to markdown, automatically Cloudflare's network now supports real-time content conversion at the source, for [enabled zones](https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/) using [content negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Content_negotiation) headers. Now when AI systems request pages from any website that uses Cloudflare and has Markdown for Agents enabled, they can express the preference for text/markdown in the request. Our network will automatically and efficiently convert the HTML to markdown, when possible, on the fly. Here’s how it works. To fetch the markdown version of any page from a zone with Markdown for Agents enabled, the client needs to add the **Accept** negotiation header with `text/markdown`as one of the options. Cloudflare will detect this, fetch the original HTML version from the origin, and convert it to markdown before serving it to the client. Here's a curl example with the Accept negotiation header requesting a page from our developer documentation: ```typescript curl https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/ \ -H "Accept: text/markdown" ``` Or if you’re building an AI Agent using Workers, you can use TypeScript: ```javascript 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(); ``` We already see some of the most popular coding agents today – like Claude Code and OpenCode – s