Most mistakes with robots controls come from treating three separate questions as one:
- Crawling: may this bot fetch this URL?
- Indexing: may this page be stored and shown in results?
- Reuse: may the content be used for something else, such as training a model or generating an answer?
Each has its own control. Using the control for one to answer another is the commonest cause of pages that are indexed when they should not be, or missing when they should be there.
Crawling: robots.txt
Robots.txt is a plain text file at the root of a host that tells crawlers which paths they may fetch. Martijn Koster proposed it in 1994. It operated as an informal convention for 28 years before being published as an internet standard, RFC 9309, in September 2022.
The rules that matter
User-agent: *
Disallow: /search/
Allow: /search/help
User-agent: GPTBot
Disallow: /
Sitemap: https://www.example.com/sitemap-index.xml
- One file per host and scheme.
https://www.example.com/robots.txtgoverns only that origin. A subdomain needs its own. - Groups. A group starts with one or more
User-agentlines followed by rules. A crawler uses the single group that best matches its name and ignores the others. It does not combine its own group with the*group. If you give a bot its own group, repeat in it every rule you still want that bot to follow. - Longest match wins. Among the rules in the chosen group, the one with the longest matching path applies. If an
Allowand aDisallowmatch equally,Allowwins. - Wildcards.
*matches any run of characters and$anchors the end of the URL.Disallow: /*.pdf$blocks URLs ending in.pdf. - Paths are case-sensitive; the user-agent name is not.
- Empty
Disallow:means nothing is blocked.
What happens when the file is missing or broken
RFC 9309 defines this, and it surprises people:
- 4xx response (including 404): the file is treated as unavailable and the crawler may fetch anything.
- 5xx response or network failure: the file is unreachable and the crawler must assume everything is disallowed. A server error on robots.txt, left unfixed, can stop a whole site being crawled.
- Caching: crawlers may cache the file, and the RFC says they should not use a cached copy for more than 24 hours in normal circumstances. A change is not instant.
- Size: crawlers must process at least the first 500 kibibytes.
What robots.txt does not do
It does not remove or hide pages. Google’s introduction says plainly that robots.txt is for managing crawler traffic and is not a mechanism for keeping a page out of Google. A disallowed URL that other pages link to can still be indexed and appear in results, typically with no description, because the crawler was never allowed to read it.
It is also public and voluntary. Anyone can read it, so listing a private directory there advertises it. And it is a request: well-behaved crawlers comply, others do not. Access that must be prevented needs authentication.
Indexing: noindex
To keep a page out of search results, use a noindex rule, which can be delivered in two ways (Google’s specification):
<meta name="robots" content="noindex">
X-Robots-Tag: noindex
The HTTP header form works for anything, including PDFs and images, which cannot carry a meta tag.
The essential point, from Google’s page on blocking indexing: the crawler has to be able to fetch the page to see the rule. If the URL is also disallowed in robots.txt, the noindex is never read, and the page can stay in the index. Blocking a page in robots.txt in order to de-index it does the opposite of what is intended.
noindex inside robots.txt itself was never part of the standard. Google announced on 2 July 2019 that it would stop honouring it from 1 September 2019.
Other directives worth knowing
| Directive | Effect |
|---|---|
nofollow |
Do not follow links on this page |
nosnippet |
Show no text snippet or video preview for this page |
max-snippet:[n] |
Limit the text snippet to n characters |
max-image-preview:[none|standard|large] |
Limit image preview size |
noarchive |
Historically, no cached copy link |
unavailable_after:[date] |
Drop the page from results after the date |
data-nosnippet (HTML attribute) |
Exclude the marked part of a page from snippets |
Rules can be addressed to one crawler by using its name in place of robots, for example <meta name="googlebot" content="noindex">. Where rules conflict, the more restrictive applies.
The decision table
| You want | Use | Do not use |
|---|---|---|
| Stop bots wasting time on faceted or internal search URLs | robots.txt Disallow |
noindex (they still get crawled) |
| Keep a page out of search results | noindex, with crawling allowed |
robots.txt |
| Remove a page already indexed | noindex or a 404/410, crawling allowed; removal tool for urgency |
robots.txt |
| Keep a private area private | Authentication | Either robots control |
| Consolidate duplicate URLs | Canonical link or redirect | robots.txt or noindex |
| Stay in search but limit quoted text | nosnippet, max-snippet, data-nosnippet |
robots.txt |
| Opt out of AI training but stay in search | Disallow the training tokens below | A blanket Disallow: / |
Reuse: AI crawlers
Since 2023 most large AI companies have published separate crawler names for separate purposes, so that a site can allow one use and refuse another. The split is usually three ways: collecting training data, building a search index for an AI product, and fetching a page live because a user asked.
| Operator | Training | AI search index | User-requested fetch |
|---|---|---|---|
| OpenAI | GPTBot |
OAI-SearchBot |
ChatGPT-User |
| Anthropic | ClaudeBot |
Claude-SearchBot |
Claude-User |
| Perplexity | none listed | PerplexityBot |
Perplexity-User |
Google-Extended |
Googlebot |
n/a | |
| Apple | Applebot-Extended |
Applebot |
n/a |
| Common Crawl | CCBot |
n/a | n/a |
Sources: OpenAI, Anthropic, Perplexity, Google, Apple. These lists change. Check the operator’s page before relying on a token.
Four points about this table are easy to get wrong.
Google-Extended and Applebot-Extended are not crawlers. They are tokens that exist only in robots.txt. Google and Apple fetch pages with their ordinary crawlers and consult the token to decide whether the content may be used for their AI models. Blocking Google-Extended does not affect crawling or ranking in Google Search.
Google-Extended does not control AI features in Search. Google’s documentation on generative AI controls says AI features in Search are part of Search and are governed by the Search controls: Googlebot access and the snippet directives. To limit what AI Overviews can show from a page, the tools are nosnippet, max-snippet and data-nosnippet, which also limit ordinary snippets.
User-requested fetchers may not consult robots.txt. Perplexity’s documentation says that Perplexity-User, which fetches a page when a person asks about it, generally ignores robots.txt because the request is made on a user’s behalf. Operators draw the line between “crawler” and “browser acting for a person” differently. Read each one’s page.
It is all voluntary. A robots.txt rule is honoured by companies that choose to honour it. Sites that need enforcement do it at the network edge, by verifying crawler IP ranges and blocking or rate-limiting what they do not want. Several CDN providers now offer this as a setting.
A sensible default
For a site that wants to remain in search and in AI search products while declining model training:
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: CCBot
User-agent: Google-Extended
User-agent: Applebot-Extended
Disallow: /
User-agent: *
Disallow: /search/
Sitemap: https://www.example.com/sitemap-index.xml
Whether that is the right choice is a business decision, not a technical one. The technical point is only that the choice is available, and that a blanket block removes you from the search products as well.
Checking your work
- Fetch the file yourself and confirm it returns status 200 with a
text/plaincontent type. A soft error page served at/robots.txtis parsed as if it were rules. - Test specific URLs against specific crawlers. Our crawler view tool fetches a page’s robots.txt and reports, for each major search and AI crawler, whether that URL is allowed and which rule decided it. It also shows the page’s meta robots and
X-Robots-Tagvalues, so you can see a blocked-and-noindexed conflict at a glance. - In Google Search Console, the Page indexing report lists URLs “Blocked by robots.txt” and those “Indexed, though blocked by robots.txt”. The second group is the conflict described above. Our guide to checking indexed pages covers the report.