How the file is read

A crawler requests https://host/robots.txt from the origin — not from a CDN path you invented — at most every 24 hours by default. RFC 9309 fixes the details that matter in practice:

  • The file must be at the root of the host. /blog/robots.txt is not a robots file.
  • It applies per scheme, host and port. http and https are separate origins; www and the apex are separate hosts.
  • Crawlers only need to read the first 500 KiB. Anything past that is ignored.
  • Up to five redirects are followed; more is treated as unavailable.

Because it is fetched by origin, putting robots.txt behind a CDN cache or an auth wall changes its behaviour without changing the file.

Groups, merging, and the classic mistake

A group is one or more User-agent lines followed by rules. Consecutive User-agent lines belong to the same group. This is the single most common error:

# WRONG — one group, three agents, one rule
User-agent: GPTBot
User-agent: CCBot
User-agent: Bytespider
Disallow: /

This is not three rules. It is one group listing three agents, and that is actually the correct way to apply the same rule to several crawlers. The error is the opposite: writing it, then adding a second rule for one of them and wondering why it did not apply. A blank line separates groups, but does not create a new group unless a new User-agent follows.

# RIGHT — one group, same result, easier to read
User-agent: GPTBot
User-agent: CCBot
User-agent: Bytespider
Disallow: /

And if you want different rules, you need separate groups:

User-agent: GPTBot
Disallow: /private/

User-agent: CCBot
Disallow: /

Matching is by product token, not by full User-Agent string, and it is case-insensitive. A crawler looks for the most specific group that names it; if none does, the * group applies. A token that appears in several groups is merged into one rule set — which is why two separate User-agent: GPTBot groups in one file behave as if combined.

The tokens that matter in 2026

TokenOperatorWhat it controls
GooglebotGoogleSearch indexing, including Images, News and Video through variants.
Google-ExtendedGoogleNot a crawler. A switch that decides whether Gemini and Vertex training may use pages Googlebot already crawled. Blocking it changes nothing about Search.
Googlebot-ImageGoogleImages only. Blocking it removes you from Image search without touching web results.
GPTBotOpenAIModel training. No effect on ChatGPT search citations.
OAI-SearchBotOpenAIThe index behind ChatGPT search. Blocking it makes your pages uncitable there.
ChatGPT-UserOpenAIA fetch caused by a person inside ChatGPT opening your link.
ClaudeBotAnthropicAnthropic's crawler for training and indexing.
Claude-UserAnthropicUser-triggered fetches from Claude.
PerplexityBotPerplexitySearch index crawler.
Perplexity-UserPerplexityUser-triggered fetches.
CCBotCommon CrawlThe public corpus many models are trained from downstream.
BytespiderByteDanceTikTok and ByteDance AI. Frequently reported to ignore robots.txt.
ApplebotAppleSpotlight, Siri and Safari suggestions.
Applebot-ExtendedAppleApple Intelligence training. Separate from Applebot, like Google-Extended is from Googlebot.
meta-externalagentMetaMeta AI training and link fetching.
BingbotMicrosoftBing index, which also feeds Copilot citations.

Two patterns in that table are worth internalising. First, the -Extended tokens are permissions on training, not crawlers: opting out of AI training at Google or Apple does not require blocking the search crawler. Second, the -User tokens are the closest thing to a person clicking a link — blocking them is a statement about linking, not about training.

Wildcards, anchors, and precedence

Google, Bing, Yandex and most modern crawlers support * anywhere in a path and $ at the end:

User-agent: *
Disallow: /*?sessionid=
Disallow: /search
Allow: /search/about
Disallow: /*.pdf$

When several rules match the same path, the longest matching pattern wins. If two rules are the same length, Allow wins. That is why Allow: /search/about beats Disallow: /search — it is longer — and why an old crawler that only supports prefix matching may still block /search/about. Allow on its own does nothing if no Disallow covers the path.

An empty Disallow: means "allow everything" and is equivalent to having no rules at all. It is not the same as Disallow: /, which blocks the whole host.

Status codes: what a 404 means

The response code is part of the protocol, and a wrong one changes your policy without touching the file:

robots.txt responseCrawler behaviour
200Parse and obey.
404 / 410No restrictions. Everything is crawlable.
401 / 403Treated as "disallow all" by RFC 9309.
429 / 5xxCrawl is suspended until the file can be read again. Google may keep using a cached copy.
Network failureRetry; persistent failure is treated as disallow.

The dangerous one is the accidental 403: a WAF rule or a broken rewrite that returns 503 for robots.txt can take a site out of search for as long as it lasts, with no change to any file you edited.

What robots.txt cannot do

It is a request, not an enforcement mechanism. A crawler that ignores it faces no technical consequence — which is exactly why the operators that ignore it are the ones people most want to block.

  • It cannot hide a page from search. Disallow stops the crawl, not the indexing: a page reached by links can still appear as a URL-only result. To keep something out of an index, let it be crawled and return noindex.
  • It cannot protect private data. Anything reachable without authentication is public. Use auth, not a text file.
  • It cannot block what ignores it. For those, you need server rules.
  • It cannot be relied on for CSS and JS. Blocking assets Googlebot needs to render a page degrades how the page is understood.

A file that says what you mean

A complete, comment-heavy example for the common "search yes, training no" policy:

# robots.txt — search allowed, training refused
# Policy last reviewed 2026-12-01

User-agent: *
Allow: /
Disallow: /admin/
Disallow: /api/

# --- Search engines: explicitly allowed -------------------------------
User-agent: Googlebot
User-agent: Bingbot
User-agent: Applebot
User-agent: DuckDuckBot
Allow: /

# --- AI training: refused --------------------------------------------
User-agent: GPTBot
User-agent: Google-Extended
User-agent: ClaudeBot
User-agent: CCBot
User-agent: Bytespider
User-agent: Applebot-Extended
User-agent: meta-externalagent
Disallow: /

# --- AI search and user fetches: allowed ------------------------------
User-agent: OAI-SearchBot
User-agent: ChatGPT-User
User-agent: PerplexityBot
User-agent: Perplexity-User
Allow: /

Sitemap: https://example.com/sitemap.xml

The explicit allow groups are redundant against the wildcard, and that is the point: they survive someone later tightening the wildcard group, and they document the decision for the next person who reads the file. A robots.txt nobody can interpret is a robots.txt nobody maintains.

To check what yours actually does — per crawler, with the deciding rule shown — run it through the site audit. To build the one above in a browser, use the generator.