robots.txttechnical seogptbotai crawlers

How to Create a robots.txt and Block AI Crawlers

Build a robots.txt with per-bot rules and a sitemap line, block GPTBot, ClaudeBot or Google-Extended, and learn what the file does not do for you.

August 22, 2026·4 min read

robots.txt is a text file served at your domain root that tells crawlers what they may request. You can create it with the robots.txt generator: choose the mode, check the bots you want to block, define the paths and add the sitemap. Since AI crawlers started collecting content to train models, the file also works as a way to state that your content shouldn't be used for that purpose.

What it is and where it lives

The file must be at /robots.txt, at the root of the service (RFC 9309). A crawler that follows the protocol looks for the group that matches its name and obeys its rules. But it is not an access mechanism: the RFC states that its rules are not a form of access authorization.

The basic structure

Each group starts with a User-agent line naming the bot, followed by Allow or Disallow rules:

User-agent: *
Disallow: /admin/
Disallow: /api/

Sitemap: https://yourdomain.com/sitemap.xml

User-agent: * covers every bot that has no group with its own name. If a bot has a group of its own, such as User-agent: Googlebot, it follows only that group (RFC 9309).

Why including the sitemap matters

The sitemap protocol lets you point to a sitemap with a Sitemap: line in robots.txt. The other option is submitting it through each search engine's tools (sitemaps.org). The line costs nothing to add, and the URL must be complete, with https://. If you also want to review the on-page SEO of the page, read the on-page SEO audit.

Blocking AI training crawlers

AI training crawlers have their own bot names, and blocking them doesn't change how search engines crawl you:

  • GPTBot (OpenAI): OpenAI says that disallowing it indicates your site's content should not be used to train its generative AI foundation models, and that each setting is independent of the others (OpenAI).
  • ClaudeBot (Anthropic): Anthropic says its bots respect robots.txt, and that a User-agent: ClaudeBot group with Disallow: / blocks it across the whole site (Anthropic).
  • Google-Extended: not a crawler with its own request, but a robots.txt token. It controls whether content Google crawls may be used to train Gemini models, and according to Google it doesn't affect inclusion in Search (Google).

To block them, add one group per bot:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Google-Extended
Disallow: /

Each bot follows the group bearing its name, so blocking GPTBot doesn't change what Googlebot does. In the generator, click the bot's name in the "Block AI bots / specific crawlers" block and the tool adds its Disallow: / group.

How to generate your robots.txt

  1. Choose the mode. "Allow all" generates Allow: /, "Block all" generates Disallow: /, and "Custom rules" lets you define groups per User-agent with their paths.
  2. Check the bots you want to block. If you need another one, type its exact name in the text field.
  3. Define the paths under "Custom rules", one per line. They must start with /, and the generator warns you if one doesn't.
  4. Add the full sitemap URL, with protocol and domain. If it doesn't have that form, the generator leaves it out and warns you.
  5. Copy or download the robots.txt and upload it to your domain root. You can then check that it responds with the HTTP headers checker.

Why it isn't a security measure

A Disallow in robots.txt doesn't stop someone from opening that URL by typing it into the browser, nor a malicious bot from requesting it while ignoring the rules. RFC 9309 states that its rules are not a form of access authorization. Content that must stay protected needs real authentication on the server.

Frequently asked questions

Does blocking GPTBot affect my Google rankings? No. OpenAI says each setting is independent, and Google says Google-Extended doesn't affect inclusion in Search. Googlebot follows its own group, or the * group if it has none.

Is having a robots.txt mandatory? No. If the file doesn't exist, RFC 9309 says the crawler may access any resource on the server.

Can I block a folder but allow one file inside it? Yes. When several rules match, RFC 9309 applies the most specific one, the longest path. For example, Disallow: /docs/ with Allow: /docs/guide.html allows that page and blocks the rest of /docs/.

Does blocking a bot in robots.txt technically block it? No. It only asks the bot not to crawl. A bot that ignores the convention can still access the content, so if you need to stop it for real, do it on the server.


Generate your robots.txt for free with the robots.txt generator: per-bot rules, sitemap and AI crawler blocking, no sign-up.

Try it without code

robots.txt Generator

Generate your robots.txt with per-bot rules and sitemap.

Open robots.txt Generator

Built by

Miguel Ángel Colorado Marin (MACM)

Full-Stack Developer · Guadalajara, España

I develop web apps, digital tools and full projects — from design to deployment.

Contact me