Cloudflare Markdown for Agents: Setup and curl Test

November 11, 2026 · 10 min read

Cloudflare Markdown for Agents: How It Works and How to Test It

Cloudflare Markdown for Agents converts a site's HTML into Markdown at Cloudflare's edge whenever a client sends Accept: text/markdown. Browsers still get the normal HTML page, while AI agents get a lighter text version of the same URL. It became generally available on 9 November 2026, and one curl command shows whether a site has it.

What Is Cloudflare Markdown for Agents?

The feature is content negotiation, the HTTP mechanism that lets one URL answer in different formats. MDN's content negotiation guide covers the basics. When a zone has the feature on and a request asks for text/markdown, Cloudflare fetches the HTML from your origin, converts it on the fly and returns Markdown.

Your origin doesn't change. You don't publish a second copy of every page, and people in a browser never see the Markdown version. Cloudflare announced it as a beta in its February 2026 launch post, which measured that post itself: 16,180 tokens as HTML against 3,150 as Markdown, roughly an 80% cut.

Why do agents care? Markdown keeps headings, lists, links and tables but drops the wrappers, class names and scripts that pad a web page. Our post on Markdown in AI explains why language models read the format so well.

Much of the launch-era coverage is now out of date. The October 2026 changelog removed the token-count headers and raised the size limit. The November release added general availability and dashboard analytics. If an article tells you to read x-markdown-tokens, it's out of date.

How Do AI Agents Request Markdown From a Cloudflare Site?

An agent adds one request header. text/markdown has to be among the types listed in Accept, but it doesn't need to be the only one. Here's the fetch call from Cloudflare's docs, lightly trimmed:

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

The response body is the page as Markdown text, served with content-type: text/markdown; charset=utf-8.

Preference weights matter. In our tests on 11 November 2026, Accept: text/markdown, text/html;q=0.9 got Markdown back from blog.cloudflare.com. A header that preferred HTML (text/html, text/markdown;q=0.5) and a normal browser header both got HTML. Cloudflare's February launch post said popular coding agents such as Claude Code and OpenCode send this kind of header.

A 30-second curl test

Run this against any page you want to check:

curl -s -D - -o /dev/null -H "Accept: text/markdown" https://blog.cloudflare.com/markdown-for-agents/

-D - prints the response headers and -o /dev/null throws the body away. On 11 November 2026 the lines that matter were these:

HTTP/2 200
content-type: text/markdown; charset=utf-8
vary: accept-encoding, accept
content-signal: ai-train=yes, search=yes, ai-input=yes

content-type: text/markdown is the proof that the conversion ran, and vary and content-signal come with it. Remove -D - -o /dev/null to read the Markdown itself.

A site without the feature answers the same request with content-type: text/html. Ours is one: ask markdowneditoronline.com for Markdown and you get HTML back.

One quirk to know: curl -I sends a HEAD request. In our test the HEAD response had the Markdown content type but no content-signal header, so use a GET like the one above when you want every header.

What the Converted Markdown Response Contains

According to Cloudflare's Markdown for Agents docs, the response has up to three parts, always in this order:

  1. YAML front matter built from the page's <meta> tags, with title, description and image fields. Open Graph title and description act as fallbacks, and the block is skipped if none of the tags exist.
  2. The body as Markdown. Headers, footers, navigation, scripts and styles are stripped before conversion.
  3. Any JSON-LD structured data, appended in one fenced json block.
---
title: Pricing
description: Plans and seat counts for every team size.
image: https://example.com/cover.png
---

# Pricing

Pick the plan that fits your team.

An agent reads that front matter as metadata and the rest as the page. Stripping isn't perfect, though. When we fetched Cloudflare's own launch post, the Markdown still opened with a Skip to content link and two Cloudflare home links before the article text.

The headers change too. Vary gains Accept, so caches keep the HTML and Markdown variants apart. ETag, Last-Modified and Content-Length are dropped, which means conditional requests aren't honored on converted responses. Security and caching headers from your origin, such as HSTS, CSP, Set-Cookie and Cache-Control, pass through unchanged.

Below is the kind of body an agent receives from a converted pricing page, with the nav and footer already gone. The front matter is left out because our editor's preview doesn't render YAML front matter. Edit the text and the preview updates as you type.

Pricing

Pick the plan that fits your team.

What each plan includes

  • Unlimited projects
  • Email support
Plan Seats
Starter 3
Team 20

Contact sales

38 words215 characters15 lines
Markdown

How Do You Enable Markdown for Agents on Your Zone?

You need a Pro, Business or Enterprise plan, or SSL for SaaS. The Free plan doesn't include it, and there's no extra charge on the plans that do. In the dashboard:

  1. Select your zone and go to Agent Readiness, then Markdown for Agents.
  2. Turn on Serve Markdown to AI agents. Your account needs permission to edit zone settings.

Older guides point to a Quick Actions toggle. The current docs mention Quick Actions only for turning it on across every custom hostname on a Cloudflare for SaaS zone.

Through the API, send a PATCH to the zone's content_converter setting, using a token with Zone Settings edit permission:

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

A successful call switches conversion on for the whole zone. To scope it to one subdomain or path instead, create a Configuration Rule under Rules, then Overview. Match the traffic with an expression such as http.host eq "docs.example.com" or starts_with(http.request.uri.path, "/blog/"), then add the Markdown for Agents setting and set it to On. We'd start with a docs or blog path, where pages are mostly text and the savings are easy to see.

Once it's running, the same dashboard page has Analytics, Logs and Playground tabs. Playground requests a path with Accept: text/markdown and shows the Markdown, a rendered preview, the response headers and an estimated token reduction next to the HTML. The GraphQL dataset markdownForAgentsAdaptiveGroups exposes the same analytics for the last seven days.

The Content-Signal Header and What It Grants by Default

Every converted response carries a content-signal header. If your origin sends one, Cloudflare keeps your value, a change that landed in July 2026. If it doesn't, Cloudflare adds ai-train=yes, search=yes, ai-input=yes, which says your content may be used for AI training, search results and AI input such as agent answers.

That default is generous. A signal states your preference, and it doesn't technically stop a crawler that chooses to ignore it. Our preference is to set your own header at the origin before you flip the toggle, so switching on Markdown doesn't announce a training permission you never meant to give.

content-signal: ai-train=no, search=yes, ai-input=yes

Sent from your origin, this keeps search and agent use but opts out of training, and Cloudflare passes it through on converted responses.

Limits: HTML Only, 6 MiB and No Token Headers

The feature has real boundaries, and a few of them trip people up:

  • HTML only. PDFs and other document types aren't converted.
  • 6 MiB of decompressed HTML (6,291,456 bytes), raised from 2 MiB on 9 October 2026. Hitting a content limit gives a partial conversion, with truncated input or missing front matter or JSON-LD, and the Analytics tab flags it.
  • No token counts. x-markdown-tokens and x-original-tokens are gone, so count tokens with your own model's tokenizer. The dashboard estimates tokens as bytes divided by four.
  • Only what the origin HTML holds. Cloudflare converts the HTML your server sends. Text a page builds with JavaScript after it loads won't be there.

That last point is the main weakness. A single-page app that ships an empty shell gives agents an almost empty Markdown file, and the toggle can't fix that.

Markdown for Agents vs llms.txt

They solve different problems. Markdown for Agents works per page: the same URL answers in HTML or Markdown depending on who asks. An llms.txt file is a single index at a fixed path that points agents to the pages you care about most.

The two complement each other, and you can run both. If you want the index file as well, our llms.txt generator builds llms.txt and llms-full.txt from your sitemap. You still upload and host the file yourself.

Getting Markdown From Sites That Don't Offer It

Most sites aren't on a paid Cloudflare plan with the toggle on, so your agent will often get HTML. Cloudflare's own fallbacks are Workers AI AI.toMarkdown(), which handles several document types, and the Browser Run /markdown endpoint, which renders a page in a real browser first.

For a one-off page, paste the URL into our URL to Markdown converter. It does a plain server fetch without running JavaScript and converts the whole body, so unlike Cloudflare's conversion, navigation and footers stay in the output. Free use shares a pool of 3 server-side operations a day. Our guide to converting a website to Markdown compares the do-it-yourself routes.

Cloudflare Markdown for Agents Questions Answered

Cloudflare Markdown for Agents gives agents a cleaner copy of your pages without changing them, as long as you're on a supported plan and you've decided what your content-signal should say. Run the curl test, check the Playground tab, and set your signal before you enable it. To see how a converted page reads, paste its Markdown into the editor and check the preview.