How to write robots.txt for AI crawlers

Give each AI crawler you care about its own group. A crawler that finds its name follows that group and ignores the wildcard one, so a dozen lines let OAI-SearchBot, Claude-SearchBot and PerplexityBot in and keep GPTBot, ClaudeBot and CCBot out.

Checked against each vendor's own docs on October 8, 2026.

Copy and paste

Three robots.txt files, by what you want.

The file lives at the root of each host, such as example.com/robots.txt, and covers only that host: blog.example.com needs its own.[1, 2]

  • In AI answers, out of training

    Search crawlers and user fetchers may read every page; training crawlers may read none. Google-Extended stays out of the list, since blocking it also takes you out of the Gemini app's grounding.[3] Keep any private paths as Disallow lines in every group.

    # AI search, and fetches people ask for
    User-agent: OAI-SearchBot
    User-agent: ChatGPT-User
    User-agent: Claude-SearchBot
    User-agent: Claude-User
    User-agent: PerplexityBot
    User-agent: Perplexity-User
    Allow: /
    
    # Model training
    User-agent: GPTBot
    User-agent: ClaudeBot
    User-agent: CCBot
    User-agent: Applebot-Extended
    User-agent: meta-externalagent
    User-agent: Amazonbot
    Disallow: /
    
    # Everyone else
    User-agent: *
    Allow: /
  • Private paths for all, training for none

    Crawlers you don't name follow the * group and skip /admin/ and /cart/. The training crawlers get a group of their own, which replaces the * group for them, so they read nothing.[1]

    User-agent: *
    Disallow: /admin/
    Disallow: /cart/
    
    User-agent: GPTBot
    User-agent: ClaudeBot
    User-agent: CCBot
    Disallow: /
  • Out of AI, still in Google and Bing

    The AI crawlers this file names stay out if they follow robots.txt, while Googlebot and Bingbot keep your search listings. OpenAI, Perplexity, Meta and Amazon say their user fetchers may not follow it, so block those at your firewall.[4, 5, 6, 7]

    User-agent: OAI-SearchBot
    User-agent: ChatGPT-User
    User-agent: GPTBot
    User-agent: Claude-SearchBot
    User-agent: Claude-User
    User-agent: ClaudeBot
    User-agent: PerplexityBot
    User-agent: Perplexity-User
    User-agent: Google-Extended
    User-agent: Applebot-Extended
    User-agent: CCBot
    User-agent: meta-externalagent
    User-agent: Amazonbot
    User-agent: Amzn-SearchBot
    User-agent: Amzn-User
    User-agent: Meta-WebIndexer
    User-agent: meta-externalfetcher
    User-agent: DuckAssistBot
    Disallow: /
How crawlers read it

Seven rules for how a crawler reads the file.

  • Names match in any case

    User-agent: gptbot and User-agent: GPTBot name the same crawler.[1, 8]

  • Its own group replaces the * group

    A crawler follows the most specific group that names it and ignores the * group; only a crawler with no group of its own falls back to *. Several User-agent lines can share one group.[1, 8]

  • The longest path wins

    When an Allow and a Disallow line both match a URL, the one with the longer path decides. On a tie, Google picks the less restrictive rule.[1]

  • No file allows all; an error blocks all

    A 404 means there are no rules. A 5xx error means crawl nothing: Google stops for 12 hours, then works from its last good copy for up to 30 days.[1, 8]

  • Changes take a day or more

    Google caches the file for up to 24 hours. OpenAI says about 24 hours, Perplexity and Meta up to 24 hours, and DuckDuckGo 72 hours.[1, 4, 5, 6, 9]

  • Only the first 500 KiB counts

    Google reads the first 500 kibibytes and ignores the rest.[1]

  • It's a request, not a lock

    The standard says its rules aren't a form of access authorization. A crawler that ignores them can still fetch your pages; only a firewall stops it.[8]

Our data

Files that name AI crawlers mostly let them in.

We read the 1,500 robots.txt files served by the sites our recorded AI answers cited, and looked for the 13 AI crawlers the X-ray checks.

37.6%

of the 1,500 files name at least one of those crawlers.

45 of 491

files that name GPTBot close their homepage to it; the other 446 leave it open.

10 of 378

files that name OAI-SearchBot, ChatGPT's search crawler, close their homepage to it.

153

files carry a Content-Signal line. 41 of them say ai-train=no, and none says search=no.

We took the 1,605 sites cited in 1,033 answers from ChatGPT, Claude, Perplexity, Gemini and Google's AI Overviews and AI Mode, recorded on October 6 and 7, 2026 for 54 questions about AI visibility tools and web analytics, and read each site's robots.txt as GEOFastBot with the X-ray's own rules on October 8, 2026. These are sites AI answers already cite, so sites that shut AI search crawlers out may be rarer here than on the web at large, and a site can serve other crawlers other rules than it served us. Shares are of the 1,500 robots.txt files we read.
Mistakes

Seven ways a robots.txt goes wrong for AI.

  • Disallow: / under User-agent: *

    It shuts out every crawler you don't name, AI search crawlers included. 12 of the 13 sites in our study with this line give AI crawlers groups of their own, which is how they let some back in. Without those groups, the file closes the site to every AI crawler.

  • Blocking the wrong OpenAI crawler

    GPTBot collects training data; OAI-SearchBot and ChatGPT-User fetch what ChatGPT reads for answers. Disallowing all three to stop training stops the answers too.[4]

  • Expecting Google-Extended to cover AI Overviews

    It doesn't. Googlebot's rules decide what AI Overviews and AI Mode may use, and the nosnippet and max-snippet tags limit what they quote.[10, 11]

  • A robots.txt that errors

    A 5xx answer tells crawlers to crawl nothing, whatever the file says when it loads. Check what your server answers for /robots.txt, not only what the file contains.[8]

  • A firewall in front of the file

    62 sites in our study refused our crawler's request for robots.txt itself. A firewall that refuses AI crawlers closes your pages to them whatever the file says. Check your firewall's settings.

  • A token with the wrong hyphen

    Perplexity's crawler table writes Perplexity‑User with a non-breaking hyphen. Pasted into robots.txt, that line names no crawler. Type the tokens, or copy them from the user-agent strings.[5]

  • Forgetting subdomains

    Each host reads only its own file, so docs.example.com and blog.example.com need theirs.[1, 2]

Content signals

A Content-Signal line states a preference.

Cloudflare's Content Signals Policy adds a line that says whether your content may be used for search, as input to AI answers and for training. Cloudflare calls the signals preferences, not technical countermeasures.[12] None of the OpenAI, Anthropic, Perplexity or Google crawler pages we read mentions them.

  • Search yes, training no

    The line sits in a group like any rule. Cloudflare's managed robots.txt, which it is replacing with Bot Preference Sync, wrote a line like it with Disallow lines for training crawlers.[13, 14]

    User-agent: *
    Content-Signal: search=yes, ai-input=yes, ai-train=no
    Allow: /
FAQ

Questions about robots.txt for AI.

  • Where does robots.txt go?

    At the root of each host, such as example.com/robots.txt. A subdomain like blog.example.com needs its own file.

  • How do I allow all AI crawlers?

    With no robots.txt, or one whose rules don't block them, every crawler may read every page. If your * group disallows paths AI crawlers should read, give those crawlers a group of their own.

  • How long until AI crawlers see a change?

    Up to a day for most, longer for some. Google caches robots.txt for up to 24 hours, OpenAI says about 24 hours, Perplexity up to 24 hours, and DuckDuckGo 72 hours for DuckAssistBot.

  • Is User-agent case-sensitive?

    No. RFC 9309 and Google both match crawler names without regard to case, so GPTBot and gptbot are the same crawler.

  • Can robots.txt stop ChatGPT from reading a page someone pastes?

    Not for certain. OpenAI says robots.txt rules may not apply to ChatGPT-User, which fetches the pages people ask about. A firewall rule stops it. Firewalls and AI crawlers

Sources

Where each fact comes from.

Each numbered source is the page a fact comes from, most of them the vendor's own documentation, read on October 8, 2026. The answers above repeat facts marked in the guide. Vendors change these pages, so check them before you act.

  1. 1Google: How Google Interprets the robots.txt Specificationdevelopers.google.com/crawling/docs/robots-txt/robots-txt-spec
  2. 2Anthropic: Does Anthropic crawl data from the web, and how can site owners block the crawler?support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler
  3. 3Google: Google's common crawlersdevelopers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers
  4. 4OpenAI: Overview of OpenAI Crawlersdevelopers.openai.com/api/docs/bots
  5. 5Perplexity: Perplexity Crawlersdocs.perplexity.ai/docs/resources/perplexity-crawlers
  6. 6Meta: Meta web crawlersdevelopers.facebook.com/documentation/sharing/webmasters/web-crawlers
  7. 7Amazon: About Amazonbotdeveloper.amazon.com/amazonbot
  8. 8IETF: RFC 9309: Robots Exclusion Protocolrfc-editor.org/rfc/rfc9309.html
  9. 9DuckDuckGo: Is DuckAssistBot related to DuckDuckGo?duckduckgo.com/duckduckgo-help-pages/results/duckassistbot
  10. 10Google: AI Features and Your Websitedevelopers.google.com/search/docs/appearance/ai-features
  11. 11Google: Robots Meta Tags Specificationsdevelopers.google.com/search/docs/crawling-indexing/robots-meta-tag
  12. 12Cloudflare: Giving users choice with Cloudflare's new Content Signals Policyblog.cloudflare.com/content-signals-policy/
  13. 13Cloudflare: robots.txt settingdevelopers.cloudflare.com/bots/additional-configurations/managed-robots-txt/
  14. 14Cloudflare: Have it both ways: stay discoverable in search while disallowing AI trainingblog.cloudflare.com/accountable-mixed-use-ai-crawlers/

Keep reading

Free X-ray

Find out what AI says about your site.

Paste your URL and leave with a ranked list of what to fix, with steps and code.

  • Free
  • No account