What should your robots.txt say?

Choose what search engines and AI crawlers may read, and add the folders to keep them out of. The file writes itself as you go, ready to copy or download. Nothing you type leaves your browser.

Default rule
AI crawlers

One per line, starting with /. End a folder with / so that /blog/ does not also catch /blog-news.

Exceptions inside a blocked folder, or the only open parts of a site where everything is blocked.

Full addresses, one per line.

Your robots.txt

        

Save it as robots.txt in the top folder of your site, so that it opens at yourdomain.com/robots.txt.

robots.txt stops crawling, not indexing. To keep a page out of Google, give it a noindex tag and check it with the noindex checker.

What it writes

  • The group for all crawlers. Your default rule, the folders you block and the exceptions you allow, under User-agent: *.
  • A group for AI crawlers, if you block them. One Disallow: / under the names their makers publish. A crawler that has its own group skips the group for everyone else, so these stay out of the whole site.
  • The common cases. The WordPress admin with admin-ajax.php left open, which is the pair of lines WordPress writes in its own default file. Internal search results. Cart and checkout.
  • Your sitemaps. One Sitemap: line each, as full URLs.
  • Only lines that work. A path has to start with / and a sitemap has to be a full address. Anything else is left out and listed, so you can fix it.

What it does not do

It does not take pages out of Google. robots.txt stops crawling, not indexing: a blocked page can still be listed, without a description, if other sites link to it. To keep a page out, leave it open to crawling and give it a noindex tag. The noindex checker shows whether Google can read it.

It does not make a crawler obey. robots.txt is a request that well-behaved crawlers follow. OpenAI and Perplexity say that ChatGPT-User and Perplexity-User, which open a page because a person asked, may not follow it.

It does not upload anything. The file is made in your browser and stays there until you copy or download it. To see how a live file treats one URL, use the robots.txt tester.

Questions

Do I need a robots.txt at all?

Not to be crawled. A site with no robots.txt is crawled as if everything were allowed. The file earns its place when there are parts crawlers should skip, or to tell them where your sitemap is.

What does "Block training" block?

The names whose makers say the pages may be used to train AI models: GPTBot, ClaudeBot, Google-Extended, Applebot-Extended, Amazonbot and Meta-ExternalAgent. It also blocks CCBot, because Common Crawl publishes its copy of the web for anyone to use. Crawlers that find pages for AI search, or fetch a page when a user asks, keep the same rules as search engines. To choose crawler by crawler, or to keep a folder for AI crawlers only, use the AI robots.txt generator.

Will blocking AI crawlers hurt my place in Google?

Google says that Google-Extended does not affect whether a site is included in Google Search and is not a ranking signal. Googlebot is a separate name and this tool never blocks it unless you block everything.

Why does my blocked folder also catch other pages?

A rule matches every address that starts with it. /blog matches /blog/, /blog-news and /blogroll.html. End a folder with / to match only what is inside it.