How to Block AI Crawlers with robots.txt

Use the exact published User-agent name for each crawler you intend to restrict, add Disallow: / to that group, preserve any search or user-requested access you still want, then publish and test the live file. Do not use User-agent: * unless you intend to restrict ordinary search crawlers too.

Independent technical reference Updated Editorial approach Report a correction
Website selectively blocking AI training crawler routes while keeping search discovery routes open

Copy-paste robots.txt example

# Restrict selected model-training and dataset crawlers
User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: Applebot-Extended
Disallow: /

User-agent: CCBot
Disallow: /

Decide what you actually want to block

There is no single technical category called “all AI crawlers.” Providers use different crawler names for model training, AI search, user-requested page retrieval, ordinary search, and product-specific content controls. A rule that is appropriate for one purpose can remove useful access when applied to another.

Your goalExamples to reviewWhat blocking may change
Restrict model-training or dataset collectionGPTBot, ClaudeBot, CCBotFuture crawling for the provider's stated training or dataset purpose.
Restrict a product-use controlGoogle-Extended, Applebot-ExtendedHow eligible content may be used by the products described in the provider's documentation. These tokens are not ordinary standalone crawler identities.
Remain available to AI searchOAI-SearchBot, Claude-SearchBot, PerplexityBotDiscovery or retrieval for the provider's AI search experience.
Allow page retrieval after a user requestChatGPT-User, Claude-User, Perplexity-UserWhether an assistant can retrieve a page when a person explicitly asks for it. Provider behavior is not identical, so check each source.
Preserve ordinary search discoveryGooglebot, Bingbot, ApplebotSearch crawling and visibility in the corresponding search products.

Write down the intended outcome before editing the file. “Block training but keep search available” is a useful policy. “Block every bot with AI in its description” is too vague to implement safely.

Confirm the exact crawler name in official documentation

Do not copy a crawler name from an old article, a server log, or a generic block list without checking the provider's current documentation. One company may publish several independent controls, and two similarly named tokens may have very different effects.

A user-agent string in a log is not proof of identity because clients can spoof it. When actual traffic matters, use the provider's published IP or DNS verification method where one is available.

Find the robots.txt response that really controls the site

Before changing anything, open the live file at the root of the exact origin, such as https://example.com/robots.txt. The file applies only to that protocol, host, and port. A policy on example.com does not automatically control www.example.com, shop.example.com, or the HTTP version of the site.

Identify where the response comes from. It may be a physical file, a CMS or SEO plugin, an application route, a hosting-panel setting, or a CDN feature. Editing a local file does nothing when another layer generates the public response. Save a copy of the current live text before making changes so existing search, sitemap, platform, and path rules are not lost.

Block the smallest set of crawler names that meets the policy

To restrict one compliant crawler across the whole host, use its exact robots.txt token with a root Disallow rule:

User-agent: GPTBot
Disallow: /

Add a separate group for each additional token you intend to block. The copy-paste example on this page restricts selected training, product-control, and dataset tokens while leaving other crawlers unchanged. It is a starting point, not a complete replacement for an existing file.

You normally do not need to add explicit Allow: / groups for every crawler you want to keep. In the absence of a matching block, crawling is allowed by default. Unnecessary allow groups can make the final policy harder to understand and can interact unexpectedly with wildcard path restrictions.

Do not let an exact group bypass wildcard restrictions

A crawler-specific group is used instead of User-agent: * when it matches that crawler. The rules from the wildcard group are not automatically inherited. Consider this file:

User-agent: OAI-SearchBot
Allow: /

User-agent: *
Disallow: /members/

The exact OAI-SearchBot group can allow /members/ because the wildcard restriction is in a different group. If the members path must remain blocked for OAI-SearchBot too, repeat the restriction in its exact group:

User-agent: OAI-SearchBot
Allow: /
Disallow: /members/

Review the complete file, not only the new snippet. This is especially important when a CMS already writes wildcard rules for administration, search, account, or checkout paths.

Use path-specific rules when a full-site block is unnecessary

You can restrict stable public sections without blocking the entire host:

User-agent: GPTBot
Disallow: /licensed-archive/
Disallow: /drafts/
Allow: /licensed-archive/public-summary/

Path matching is based on the URL path, and the most specific matching rule normally wins. Test the actual URLs you care about, including case, wildcards, end anchors, and query strings where relevant. Do not list secret locations as a substitute for security: robots.txt is public and can reveal the path names it contains.

Avoid the blanket wildcard block unless that is the real goal

User-agent: *
Disallow: /

This rule asks every compliant crawler to avoid the entire host. It can affect Googlebot, Bingbot, AI search crawlers, monitoring tools, accessibility services, archives, and other automated clients. Use it only for a staging host or another situation where broad crawl exclusion is genuinely intended.

If your goal is to keep ordinary search available while restricting selected training or dataset uses, use named groups instead. The selective AI policy guide explains that narrower decision in detail.

Publish the file at the exact origin

  1. Merge the new groups into the current live file instead of replacing unrelated rules.
  2. Serve the result at /robots.txt on every host that needs the policy.
  3. Return a stable successful response containing UTF-8 plain text rather than an HTML error page.
  4. Keep the file reasonably small and remove duplicate or obsolete groups.
  5. Open the public URL after deployment and confirm that the response matches the text you intended to publish.

The Google robots.txt specification guide gives practical details about origin scope, redirects, HTTP errors, caching, encoding, and file-size handling. The standard protocol is defined in RFC 9309.

Verify both blocked and preserved access

  1. Use the live robots.txt checker with each crawler name you changed.
  2. Test / and representative deeper paths rather than assuming one result covers the whole site.
  3. Check ordinary search crawlers that must remain available.
  4. Review the matched group and winning rule, not only the final Allowed or Blocked label.
  5. Allow time for providers to refresh cached robots.txt rules.
  6. Review server logs when you need evidence of real requests and responses.

For a more detailed verification process, use How to Check Whether AI Crawlers Are Blocked. When the final file is difficult to reason about, rebuild a draft with the generator and merge it carefully with the existing policy.

Use real access controls for private or licensed content

Robots.txt is a voluntary crawling instruction, not authentication, authorization, copyright enforcement, or a paywall. A client that ignores the protocol can still request a public URL. Protect private files, customer data, paid content, administration areas, and confidential APIs with server-side access controls, application permissions, rate limits, or bot-management rules.

Crawl blocking is also different from search deindexing. A blocked URL can still be discovered from links, and a crawler may be unable to see a page-level noindex directive when the page itself is disallowed. Choose indexing controls and security controls according to the actual outcome you need.

Final checklist before publishing

  • The exact crawler name and purpose were confirmed in current provider documentation.
  • The rule changes only the access you intend to change.
  • Existing search, sitemap, platform, and path rules were preserved.
  • Exact crawler groups do not accidentally bypass wildcard restrictions.
  • The file is served from the correct protocol, host, port, and root path.
  • The live response and representative URLs were tested after deployment.
  • Private material is protected independently of robots.txt.

FAQ

Can one robots.txt rule block every AI crawler?

A User-agent: * block asks every compliant crawler to stay out, including ordinary search engines and other automated services. It still cannot stop clients that ignore robots.txt. Use exact crawler groups when your goal is selective control.

Does blocking GPTBot also block OAI-SearchBot or ChatGPT-User?

No. OpenAI publishes them as independent controls for different purposes. Set and test each token separately according to the access you want to preserve.

Should I block Google-Extended or Googlebot?

They are different controls. Google-Extended manages eligible content use for the Google products described in its documentation, while Googlebot is used for Google Search crawling. Blocking Googlebot can affect search visibility.

Do I need to add Allow groups for crawlers I want to keep?

Usually not. Crawling is allowed when no matching Disallow rule blocks the path. Add an explicit Allow group only when it is needed to override or clarify an existing policy, then test how it interacts with wildcard rules.

Why can an exact crawler group ignore User-agent: * restrictions?

A matching crawler-specific group is selected instead of the wildcard group, and wildcard rules are not automatically inherited. Repeat any required path restrictions inside the exact group.

Can I block an AI crawler from only part of the site?

Yes. Add path-specific Disallow rules under the exact crawler group and test representative URLs. Do not rely on a public robots.txt path list to protect sensitive content.

Where must robots.txt be published?

Serve it as /robots.txt at the root of the exact protocol, host, and port it controls. Subdomains and different protocols can require separate files.

How quickly will a crawler follow a new rule?

Not always immediately. Providers can cache robots.txt and refresh it on different schedules. Confirm the live response, allow time for refresh, and use logs when actual behavior matters.

Will robots.txt stop an AI scraper that ignores the file?

No. Robots.txt is voluntary. Use authentication, authorization, server rules, rate limiting, WAF, or bot-management controls when access must be enforced.

Continue with the tools

Build a policy from the guidance above, then test the complete file that is actually published.

Related pages

Robots.txt generator controls and a generated rules document AI robots.txt Generator

Choose a preset or set individual crawler rules. The generator shows what will be allowed or blocked, highlights issues to review, and gives you a robots.txt file to publish yourself.

Robots.txt checker inspecting a website and reporting allowed and blocked crawler access robots.txt Checker

Enter the exact website address, choose a crawler, and test a path. The checker reads the live robots.txt file and explains the group and rule that determine access.

Website allowing an AI search discovery route while blocking a separate model-training route How to Allow AI Search but Block AI Training

Block only the documented training or product-use controls, such as GPTBot, ClaudeBot, Google-Extended, and Applebot-Extended. Leave AI search crawlers unblocked unless an existing rule blocks them; add explicit search groups only when necessary, and repeat any private-path restrictions inside those groups. Then test the live file by crawler and path.

Diagnostic flow checking a crawler token, URL rule match, server response, and access logs How to Check Whether AI Crawlers Are Blocked

Fetch the live robots.txt file, select the crawler’s exact product token, and test the specific URL against the matching group and longest Allow or Disallow rule. Then check HTTP responses, caching, firewall rules, and logs, because a crawler may be allowed by robots.txt yet blocked by the server—or disallowed by robots.txt while an unidentified scraper still reaches the page.

Robots.txt workspace showing wrong location, overbroad blocking, path conflicts, and false security assumptions Common robots.txt Mistakes and How to Fix Them

The most damaging robots.txt mistakes are publishing the file on the wrong host, blocking every crawler with a wildcard, confusing crawl control with deindexing or security, using incorrect path rules, and failing to test the complete file. Validate exact URLs and crawler groups before deployment.

Voluntary robots.txt crawler rules shown separately from enforceable server-side access controls Does robots.txt Stop AI Scraping? Limits and Better Controls

Robots.txt can stop compliant AI crawlers from requesting selected URLs, but it cannot enforce access against unidentified scrapers, spoofed user agents, browsers, or tools that ignore the protocol. Use precise crawler rules for policy, then add authentication, authorization, rate limits, or firewall controls where access must actually be prevented.