Webmaster Bench

Tools / Guides / How to block GPTBot, ClaudeBot and other AI crawlers in robots.txt

How to block GPTBot, ClaudeBot and other AI crawlers in robots.txt

Two lines per crawler do it. The part that needs care is choosing which crawlers to block, because several of them are not training crawlers at all.

Published 2026-11-17. Last updated 2026-11-17. Written by Webmaster Bench; see About for how the guides are made and checked.

Try it: robots.txt Generator: Build a correct robots.txt: block folders, add sitemaps, opt out of AI training crawlers.

The short answer

Add one group per crawler to the robots.txt file at the root of your site, each with Disallow: /:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

Save it as https://yourdomain/robots.txt, UTF-8 plain text. OpenAI says that "disallowing GPTBot indicates a site's content should not be used in training generative AI foundation models", and Anthropic gives the same two-line rule for ClaudeBot. The rest of this guide is about which names to put in, and how to check that the file does what you meant.

Which crawler does what

The names below come from each operator's own documentation (linked at the end). Several operators run more than one crawler, and the choice between them is a choice about what you want to keep: training use, appearing in AI search answers, or answers to a user who asks about your page.

Token (operator)What the operator says it is forIf you block it
GPTBot
OpenAI
Crawls content that may be used to train its generative AI foundation models.Content should not be used for that training.
OAI-SearchBot
OpenAI
Shows websites in ChatGPT's search features."Sites that are opted out of OAI-SearchBot will not be shown in ChatGPT search answers." OpenAI says changes can take about 24 hours to apply.
ChatGPT-User
OpenAI
Page visits that a user triggers in ChatGPT, not automatic crawling."Because these actions are initiated by a user, robots.txt rules may not apply."
ClaudeBot
Anthropic
Collects web content that could contribute to model training.Anthropic: this signals that your site's future materials should be excluded from its AI model training datasets.
Claude-User
Anthropic
Fetches a page when a Claude user asks a question that needs it.Claude cannot retrieve your page for a user query. Anthropic notes this may reduce your visibility in user-directed search.
Claude-SearchBot
Anthropic
Crawls the web to improve search result quality.Your content is not indexed for search optimisation. Anthropic notes this may reduce visibility and accuracy in search results.
Google-Extended
Google
A robots.txt token controlling whether content Google crawls may be used to train future Gemini models.No effect on Google Search: Google says it "does not impact a site's inclusion in Google Search nor is it used as a ranking signal". It is not a separate crawler and has no user agent string of its own.

On a narrow screen, swipe the table sideways for the other columns.

So "block all AI" is really three decisions. Blocking only the training tokens (GPTBot, ClaudeBot, Google-Extended) keeps your pages eligible for ChatGPT search and for user-requested fetches. Blocking the search and user tokens as well keeps you out of those answers too. Other operators (Common Crawl's CCBot, Perplexity, Meta, Apple and others) publish their own tokens; check their pages for the current names before relying on a list, including this one.

Advertisement

Worked example, run through the tools

We filled in the robots.txt generator with /admin/ as a disallowed folder, a sitemap, and five AI tokens ticked or typed into "Block other crawlers" (Claude-SearchBot and Claude-User are not in the checkbox list). It produced:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: Claude-SearchBot
Disallow: /

User-agent: Claude-User
Disallow: /

User-agent: *
Disallow: /admin/

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

We then pasted that file into the robots.txt tester and asked about a blog post, trying each crawler name. The table is the tester's own output:

CrawlerResultURL pathDecided by
GPTBotBlocked/blog/postline 2: Disallow: /
ClaudeBotBlocked/blog/postline 5: Disallow: /
Google-ExtendedBlocked/blog/postline 8: Disallow: /
OAI-SearchBotAllowed/blog/postno rule in the * group matches
ChatGPT-UserAllowed/blog/postno rule in the * group matches
GooglebotAllowed/blog/postno rule in the * group matches
OAI-SearchBotBlocked/admin/xline 17: Disallow: /admin/

On a narrow screen, swipe the table sideways for the other columns.

Look at the last two rows. OAI-SearchBot and ChatGPT-User have no group of their own, so they follow the * group: allowed on the blog post, blocked from /admin/. That is the behaviour RFC 9309 specifies: a crawler uses the group that names it, and otherwise the * group. If you meant to keep OpenAI's search crawler out as well, you need a User-agent: OAI-SearchBot group; the file above deliberately does not have one.

The mistake that silently undoes a block

A crawler obeys only the group that names it, not that group plus *. Suppose you want /private/ hidden from everyone, and /drafts/ hidden from GPTBot as well:

User-agent: *
Disallow: /private/

User-agent: GPTBot
Disallow: /drafts/
CrawlerResultURL pathDecided by
GPTBotAllowed/private/report.htmlno rule in the gptbot group matches
GPTBotBlocked/drafts/postline 5: Disallow: /drafts/
SomeOtherBotBlocked/private/report.htmlline 2: Disallow: /private/

On a narrow screen, swipe the table sideways for the other columns.

GPTBot may fetch /private/report.html, because its own group does not mention /private/. If GPTBot needs to be kept out of both, repeat the /private/ rule inside its group. Google documents the same selection rule: a crawler uses "the group with the most specific user agent that matches". Paste your file into the tester and try a path from the * group under each AI token to catch this.

What robots.txt does not do

  • It is a request, not access control. RFC 9309 says: "These rules are not a form of access authorization." A crawler that ignores robots.txt, or one that fakes a user agent, is not stopped. For content that must not be fetched, use authentication.
  • Do not block by IP address instead. Anthropic warns that blocking its IP addresses is not a reliable opt-out, because it can stop the crawler from reading your robots.txt at all.
  • One file per host. Anthropic asks you to repeat the rule on every subdomain you want to opt out. Google's documentation says the same of its own: rules apply only to the protocol, host and port where the file is served.
  • User-triggered fetches may ignore it. OpenAI says so for ChatGPT-User.

Check it after publishing

  1. Open https://yourdomain/robots.txt in a private window and confirm it shows the new file.
  2. Paste it into the tester and try a few URLs under each token you care about.
  3. If you keep server logs, open them in the crawler log analyzer a few days later to see which crawlers still request your pages.

Sources

Advertisement