robots.txt

nounalso called robots exclusion protocol or robots file

Definition

robots.txt is a plain-text file at a site’s root that tells crawlers which paths they may fetch, rule by rule for each user agent — a voluntary standard that reputable search and AI bots follow, which controls crawling but not whether a URL gets indexed.

Updated 6 min read8 cited sources

On this page8 sections

Why it matters for founders and small teams

robots.txt is the one file every search and AI engine checks before reading your site, and a single wrong line in it can remove you from Google, ChatGPT or Claude without any error message. For a small team, it’s also the cheapest place to make deliberate choices — search yes, training your call — instead of inheriting whatever a CMS plugin or CDN default decided for you.

How does robots.txt work?#

robots.txt works by listing groups of rules, each starting with one or more User-agent lines, that tell a named crawler which URL paths it may or may not fetch; a crawler reads the file at the site’s root before crawling and follows the single group that best matches its name.

The format was first proposed by Martijn Koster in 1994 and became an internet standard, RFC 9309, in September 2022. The rules that matter most in practice:

  • One file per host. It must sit at /robots.txt and covers only that protocol, host and port, so blog.example.com needs its own.
  • The most specific group wins. A crawler follows the group that names it and ignores User-agent: * entirely. Google never merges a named group with the * group.
  • The longest matching path wins within a group. When an Allow and a Disallow match equally, the RFC and Google both favor the Allow.
  • Matching rules: user-agent names are case-insensitive, paths are case-sensitive, * matches any run of characters and $ anchors the end of a URL.
  • It’s cached. The RFC says crawlers shouldn’t rely on a cached copy for more than 24 hours; OpenAI and Perplexity say changes take up to about a day to apply.

One rule sits above the rest: robots.txt is a request, not a lock. The RFC says its rules “are not a form of access authorization,” and Google notes that while reputable crawlers obey them, “other crawlers might not.” See AI crawlers for which AI bots honor it.

How do I set up robots.txt for AI crawlers?#

Set up robots.txt for AI crawlers by giving each search and user-triggered bot an explicit Allow, making one deliberate decision for all the training tokens, and keeping Googlebot allowed, since Google’s AI features and Claude’s search index both depend on it.

robots.txt
# Search engines and AI search indexes: allow
User-agent: Googlebot
User-agent: Bingbot
User-agent: OAI-SearchBot
User-agent: Claude-SearchBot
User-agent: PerplexityBot
Allow: /
Disallow: /account/
 
# Live fetches for a user's question: allow
User-agent: ChatGPT-User
User-agent: Claude-User
User-agent: Perplexity-User
Allow: /
Disallow: /account/
 
# Model training: your call (change Allow to Disallow to opt out)
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: CCBot
User-agent: Google-Extended
User-agent: Applebot-Extended
Allow: /
Disallow: /account/
 
# Everyone else
User-agent: *
Disallow: /account/
 
Sitemap: https://example.com/sitemap.xml
  • One group can name several bots. RFC 9309 allows multiple User-agent lines above one set of rules, which keeps the file short.
  • Every group repeats your private paths, because a named group doesn’t inherit anything from *.
  • Disallowing Google-Extended also ends Gemini-app grounding, not just training. It’s the one training token with a search-side cost. See Google-Extended.
  • ChatGPT-User and Perplexity-User may ignore robots.txt anyway, by their vendors’ own account. Use a firewall rule if you need a hard block.
  • Then check the CDN. A bot-management rule can block a bot that robots.txt allows.

The AI robots.txt generator produces a starting file you can adapt.

Rankbox benchmark

The robots.txt Limits Sheet

The hard numbers that decide how crawlers read your file, from the standard and the vendors’ own documentation. Check your setup against each row.

500 KiB

File size read

RFC 9309 requires crawlers to parse at least 500 kibibytes, and Google ignores anything past its 500 KiB limit. Keep the file small and the important rules near the top.

24 hours

Cache lifetime

The RFC says crawlers shouldn’t use a cached copy for more than 24 hours, and Google generally caches for up to 24 hours.

~24 hours

AI vendor pickup

OpenAI says changes take about 24 hours to reach its systems; Perplexity says up to 24 hours. Make changes a day before you need them.

5 hops

Redirects followed

The RFC says crawlers should follow at least five consecutive redirects to reach the file. Serve it directly with a 200 instead.

Crawl all

File returns 4xx

A missing file means crawlers may fetch anything, under both the RFC and Google’s rules.

Crawl none

File returns 5xx

The RFC treats an unreachable file as a complete disallow; Google pauses crawling for 12 hours, then uses its cached copy for up to 30 days.

How to read it: The last row is the one that surprises people: a robots.txt that errors under load can make crawlers back off the whole site. Serve it as a static file that returns a 200 on every host, and recheck it after any migration or CDN change.

Free to use and adapt. If you cite it, link to rankbox.xyz/glossary/robots-txt.

robots.txt vs noindex: what's the difference?#

robots.txt controls whether a crawler may fetch a URL, while a noindex directive controls whether a fetched page may appear in results — so a URL blocked in robots.txt can still be indexed from links elsewhere, and the crawler must be allowed in to see a noindex at all.

Google says robots.txt “is not a mechanism for keeping a web page out of Google”: a disallowed URL “can still be indexed if linked to from other sites,” appearing with its address but no description. OpenAI says the same of ChatGPT, where a site opted out of OAI-SearchBot “can still appear as navigational links,” and Brave notes that “robots.txt is not used to prevent a page from being indexed.”

You want…UseNot
A bot to stop fetching a pathA robots.txt Disallownoindex (the bot must fetch the page to see it)
A page out of search resultsnoindex, with crawling allowedrobots.txt alone
Text kept out of Google’s AI answersnosnippet or data-nosnippetrobots.txt
Content that’s actually privateAuthenticationEither one: both are public requests

Listing a path in robots.txt also advertises it: the RFC warns that doing so “exposes them publicly.” Never use it to hide anything sensitive. See indexing and snippet controls.

How do I test robots.txt?#

Test robots.txt by fetching the live file from every host, checking which group each crawler you care about actually matches, and confirming in Search Console’s robots.txt report that Google fetched it without errors, then request a key page with each bot’s user agent to catch CDN blocks.

bash
# 1. The file as crawlers see it (repeat for every host)
curl -s https://example.com/robots.txt
curl -s https://blog.example.com/robots.txt
 
# 2. The status code changes the meaning (see below)
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/robots.txt
 
# 3. Can a bot actually get a page? Catches user-agent blocks at the CDN
curl -s -o /dev/null -w "%{http_code}\n" -A "Claude-SearchBot" https://example.com/pricing
  • Status codes change everything. Under RFC 9309, a 4xx on robots.txt means crawlers may fetch anything, and a 5xx means they must assume everything is disallowed. Google stops crawling for 12 hours after a 5xx, then falls back to a cached copy for up to 30 days.
  • Search Console’s robots.txt report lists the files Google found for your top hosts, when it last fetched them, and any parse errors. See Google Search Console.
  • A curl with a bot’s user agent tests user-agent rules only. IP-based bot management can still treat the real bot differently, so check your CDN’s firewall log for challenges too.

Common mistakes with robots.txt#

The most common robots.txt mistakes are a leftover Disallow: / from staging, blocking a search bot instead of a training bot, forgetting that named groups ignore the * rules, and assuming the file you wrote is the file being served.

Myth

The staging Disallow came off at launch.

Reality

Check. One Disallow: / under User-agent: * blocks every search and AI bot that doesn’t have a group of its own.

Myth

Blocking GPTBot or ClaudeBot hides me from their chatbots.

Reality

Both are training-only. Search is OAI-SearchBot, Claude-SearchBot and PerplexityBot. See GPTBot.

Myth

My robots.txt is exactly what I wrote.

Reality

Cloudflare’s managed robots.txt prepends rules to your file, including disallows for Google-Extended and Applebot-Extended, which opts you out of Gemini-app grounding. Read the file as served.

Myth

robots.txt is the only gate.

Reality

From 15 September 2026, Cloudflare blocks multi-purpose crawlers such as Googlebot for customers who choose to block Training, whatever robots.txt says.

Myth

A Crawl-delay line slows every bot.

Reality

It isn’t part of the standard. Google ignores Crawl-delay; Anthropic supports it. Check each vendor.

Sources

  1. 1.RFC 9309: Robots Exclusion ProtocolIETF · rfc-editor.org
  2. 2.Introduction to robots.txtGoogle Search Central · developers.google.com
  3. 3.How Google interprets the robots.txt specificationGoogle Search Central · developers.google.com
  4. 4.robots.txt reportSearch Console Help · support.google.com
  5. 5.Overview of OpenAI crawlersOpenAI · developers.openai.com
  6. 6.Perplexity crawlersPerplexity Docs · docs.perplexity.ai
  7. 7.Control content use for AI training with Cloudflare's managed robots.txtCloudflare · blog.cloudflare.com
  8. 8.Your site, your rules: new AI traffic options for all customersCloudflare · blog.cloudflare.com

Know someone who’d find this useful? Send it their way.

Written by

Rankbox Team

The team behind Rankbox. We study how ChatGPT, Perplexity, Gemini, and Google AI Overviews choose their sources, and publish what we learn so you can put it to work.

See which AI answers cite you today

Enter your site to see how often ChatGPT, Perplexity, Gemini, and Google cite your brand, and exactly what to publish next.

No credit card required · Free 7-day trial