Learn
How to block AI crawlers in robots.txt without locking out agents
Copy-paste robots.txt blocks for GPTBot, ClaudeBot, Google-Extended, PerplexityBot and CCBot. Block training, keep search, and what Cloudflare Block changes.
8 min read 1865 words
Reviewed by a human editor before publication. How we write
- robots.txt
- AI crawlers
- Content Signals
- Cloudflare
- bot access
To block AI crawlers, write the refusal in robots.txt by product token. Add Disallow: / for each training crawler, such as GPTBot and ClaudeBot. Add a Content-Signal line that separates training from search and retrieval.
Do not block by IP range, or block everything automated. That also refuses the agent a customer just asked to check your price, and it makes your site impossible to measure.
Copy-paste robots.txt blocks, one per operator
The AI robots.txt generator builds one group from the crawlers you tick, and the AI crawler checker reads the file you publish.
Paste the groups you want. Each refuses one operator's crawler for the whole site.
# OpenAI: model training. OAI-SearchBot and ChatGPT-User are separate tokens.
User-agent: GPTBot
Disallow: /
# Anthropic: model training. Claude-SearchBot and Claude-User are separate tokens.
User-agent: ClaudeBot
Disallow: /
# Google: Gemini training and grounding. Google Search is unaffected.
User-agent: Google-Extended
Disallow: /
# Perplexity: its search crawler, not a training one.
User-agent: PerplexityBot
Disallow: /
# Common Crawl: an open crawl archive.
User-agent: CCBot
Disallow: /
GPTBot and ClaudeBot collect training data, and their search and user-fetch counterparts have their own tokens. The OpenAI and Anthropic guides say what blocking each one changes. PerplexityBot is different. Perplexity says it surfaces sites in Perplexity search and is not used for foundation models, so blocking it removes you from those results.
Why block AI crawlers at all?
A block is not the only lever. A 429 with Retry-After slows a crawler without refusing it, and Google-Extended covers Gemini but not AI Overviews.
Three reasons hold up. Cost: a crawler that walks every URL under every filter combination spends bandwidth and origin capacity. Training: using your content to train a model is a use you may not have agreed to. That is a rights decision, not a security one. Copying: a competitor mirroring your catalogue or pricing is plainly harmful.
"Block everything automated" is not a reason. The same HTTP client shape covers a price-checking agent, a search indexer that sends you traffic, an uptime monitor and a scraper. A rule that refuses all 4 has not made a policy.
AI crawlers vs search crawlers: training, search, user-triggered
Operators now split their crawlers by purpose, so you can refuse one purpose and allow another.
| Kind | Token | What the operator says it does | What Disallow does |
|---|---|---|---|
| Training | GPTBot (OpenAI) |
Crawls content that may train its foundation models | Signals the content should not be used for training |
| Training | ClaudeBot (Anthropic) |
Collects content that could train models | Excludes future material from training |
| Training | Google-Extended (Google) |
A robots.txt token, not a crawler | Stops use for Gemini training and grounding; Search is unaffected |
| Search | OAI-SearchBot (OpenAI) |
Surfaces sites in ChatGPT search | Removes the site from ChatGPT search answers |
| Search | Claude-SearchBot (Anthropic) |
Improves search result quality | Content is not indexed for search |
| User-triggered | ChatGPT-User (OpenAI) |
Visits pages when a user asks ChatGPT | OpenAI says robots.txt rules may not apply |
| User-triggered | Claude-User (Anthropic) |
Retrieves a page when a user asks | Content is not retrieved for user queries |
Descriptions from OpenAI, Anthropic and Google. The ai-rules check resolves 18 such tokens against your file.
Some crawlers do both jobs. Cloudflare calls Applebot, Bingbot and Googlebot mixed-use: one crawler serves search and training. Google offers a control token, Google-Extended, for the training half. A blunt block on a mixed-use crawler costs you search.
Block training, keep search
Refuse training by name, keep search and retrieval for a user open, and put the rationale on a page.
# Policy and rationale: https://example.com/ai-policy
# Training is refused. Search and retrieval for a user are allowed.
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
Disallow: /
User-agent: OAI-SearchBot
User-agent: ChatGPT-User
User-agent: Claude-SearchBot
User-agent: Claude-User
Allow: /
Disallow: /account/
Disallow: /cart/
User-agent: *
Content-signal: search=yes, ai-input=yes, ai-train=no
Allow: /
Disallow: /account/
Disallow: /cart/
Disallow: /search
Disallow: /*?sort=
Disallow: /*?filter=
Sitemap: https://example.com/sitemap.xml
The first comment points at the page that explains the policy, so an operator who disagrees knows whom to ask. The retrieval group repeats the Disallow lines, because a named group does not inherit from *. The disallowed paths are session URLs, parameter permutations and anything behind a login. Google-Extended also refuses Gemini grounding, so it refuses more than training.
On scoring, ai-rules credits a named group only when it allows /. A group that only disallows / reads Not used, so the training refusal earns nothing there. The retrieval group makes the check Present, and content-signal scores the training refusal.
This site's own file names 18 AI tokens, Claude-SearchBot the latest, and its record of 2 November 2026 reads each in its own group. Each group allows /, disallows /api/ and carries Content-Signal: ai-train=yes, search=yes, ai-input=yes, because the site permits training. Its policy is at /ai-policy; the ai-policy check reads such a page only when a site restricts AI use. The scanner no longer checks for an agent identity page, and /methodology says why.
What do Cloudflare's Block and Disallow AI Training change?
Cloudflare's Block setting can stop Googlebot and Bingbot. Its Disallow AI Training setting does not. Both belong to a model of Search, Training and Agent behaviour, published on 15 September 2026. Agent means a user-directed visit, such as a chat fetch or a browser-use agent. A domain's Training setting offers Allow, Disallow AI Training, Block on pages with ads and Block.
The difference is the mixed-use crawler, which does search and training in one. From 15 September 2026, Block applies to these too. Cloudflare says it stops Applebot, Bingbot and Googlebot from reaching your site, search included. Disallow AI Training publishes a no-training preference in robots.txt instead, and the mixed-use crawlers Cloudflare calls Accountable stay allowed for search. For Google the token is Google-Extended, and Google says disallowing it does not affect Search. Every other training crawler is blocked, including the training-only crawlers of Amazon, Anthropic, Meta and OpenAI.
That day a new domain is offered one of 2 presets. A site without ads gets Allow for Search, Training and Agent. An ad-supported site gets Search Allow, Training Disallow AI Training and Agent Block on pages with ads. A domain that never used the granular controls is migrated from the legacy Block AI setting, and Block becomes the second preset. Agent has no Disallow option, because Cloudflare says no established directive exists for it.
Bing is the gap. Cloudflare says Bing does not read a no-training preference from robots.txt yet, and Microsoft targets early 2027. Until then it suggests the NOARCHIVE meta tag or Bing's content removal tool.
Cloudflare writes the preference into your robots.txt ahead of your own file, so check the merged result. AI Crawl Control is the dashboard for allowing or blocking single crawlers.
Why not block AI crawlers by IP address?
| Mechanism | What it keys on | Can it separate a signed agent from a scraper? |
|---|---|---|
| IP-level block | Source network | No |
| User-agent rule | A string the client chooses | No |
| Signed-agent policy | A key the client holds | Yes, for the operator only |
Signed-agent schemes such as Web Bot Auth verify a signature, not an address. They exist because agent operators run on the same clouds as scrapers. A rule that denies datacenter ranges denies signed agents by construction.
Anthropic gives a second reason. It says IP blocking "may not work correctly or persistently guarantee an opt-out", because it can stop its crawler from reading your robots.txt at all. It publishes crawler addresses to help you identify traffic, not to block it.
A site behind such a block also cannot be measured, because a scanner running from a datacenter cannot reach it. The correct result is not measured, not a low score. The reachable check records the status code behind it.
How do named groups and the wildcard interact?
RFC 9309 is a Standards Track RFC, so this is a specified format. Three rules cause most mistakes.
A user-agent string is not a credential. The product token "SHOULD be a substring of the identification string", and the client composes that string. Forging GPTBot takes one line of code. A rule works against operators who choose to honour it. RFC 9309 says its rules are not a form of access authorization.
A named group replaces the wildcard for that crawler. The * group applies only when no group matches the crawler. If you give GPTBot its own group, it stops following your * rules. Repeat the path rules in every named group, or the crawler may read paths you meant to protect.
Specificity decides, not position. Groups that match the same crawler are combined into one. In the combined group the most specific rule, the one with the most octets, applies. An equivalent Allow beats a Disallow.
What are Content Signals?
Content Signals separate collection from use. Cloudflare's policy defines 3 categories in a Content-signal line.
search: building a search index and returning links, but not AI summaries.ai-input: feeding content into a model at request time, such as retrieval or grounding.ai-train: training or fine-tuning a model.
A signal you leave out neither grants nor restricts permission. Cloudflare's managed block adds a line such as Content-signal: search=yes, ai-train=no, use=reference under User-Agent: *. Its page calls use=reference a signal Cloudflare is testing. Google Search Console may report "Syntax not understood" for the line. Cloudflare says it has seen no effect on crawling.
Content Signals is a published policy, not an IETF standard. The AI Preferences working group is standardising a vocabulary and ways to attach it, including robots.txt and HTTP header fields. Its drafts are not RFCs yet.
The content-signal check asks only whether a signal is present and states yes or no. The rubric notes that no crawler documents honouring it, so it is a statement of intent.
How do you verify that robots.txt does what you think?
Do not read the file. Read what the server returns, because the two often differ.
- Fetch it as a plain client. A CDN may prepend a managed block. Cloudflare's documentation says it places managed directives ahead of the origin file, and crawlers parse the merged result.
- Apply the RFC 9309 algorithm to the paths you care about, with the token each crawler sends.
- Request a disallowed path with the exact user-agent string. robots.txt blocks nothing by itself, so expect a
200. A403or429means an edge rule enforces the policy, and then your edge rules are the real policy. - Request a permitted path with the same string. A
403there means your edge refuses the agent traffic you wanted.
curl -sS https://example.com/robots.txt
curl -sS -o /dev/null -w '%{http_code}\n' -A 'GPTBot' https://example.com/cart/
curl -sS -o /dev/null -w '%{http_code}\n' -A 'OAI-SearchBot' https://example.com/pricing
Scan your site to see which of the 18 tokens your file names and how each resolves.
What can robots.txt not enforce?
robots.txt is advisory. A crawler that ignores it meets no protocol-level consequence. OpenAI's documentation says ChatGPT-User visits happen because a user asked, and that robots.txt rules may not apply to them. A Disallow for that token is a declaration, not a lock.
A user-agent rule also cannot authenticate, so a policy that depends on a name works only on operators who choose to be honest. Against one who does not, your options are edge rules, rate limits and signed agents, which verify a key and not a string. Signing is still a draft: the Web Bot Auth working group has published no RFC, and implementations differ.
If a network-layer block leaves your site not measured, that is a fact about the block. What agent readiness means explains why we report it as not measured.