In short
robots.txt is a plain text file at the root of your site that tells crawlers which URLs they may fetch. It controls crawling, not indexing, so a blocked URL can still appear in Google, just without a snippet. The same file is also how you tell AI crawlers such as GPTBot or the Google-Extended token whether your content may be used for model training or AI search answers.
What robots.txt does and does not do
A Disallow rule tells a crawler “do not fetch this URL”. It does not tell Google “do not show this URL in search”. Those are two different instructions, and mixing them up is the root of most robots.txt problems.
If a page is blocked, Google cannot read its content. But if other pages link to it, Google can still index the bare URL and show it in results without a description. To keep a page out of search, you need noindex in a robots meta tag or an X-Robots-Tag HTTP header, and the page must stay crawlable so Google can see that rule.
robots.txt is also voluntary. Well-behaved crawlers follow it, but it is not access control: anyone, and any bot that ignores the file, can still open a blocked URL. Private content needs a password or other authentication.
What Google officially says
“Google can't index the content of pages which are disallowed for crawling, but it may still index the URL”
Google Search Central — robots.txt documentation. Such URLs are shown without a snippet.“Google supports the following fields (other fields such as crawl-delay aren't supported)”
Google Search Central — robots.txt documentation. The supported fields areuser-agent, allow, disallow and sitemap.A few more rules from the same documentation, each a direct quote:
- “You must place the robots.txt file in the top-level directory of a site, on a supported protocol.”
- The rules “apply only to the host, protocol, and port number where the robots.txt file is hosted.”
- “Google enforces a robots.txt file size limit of 500 kibibytes (KiB).” Content after that limit is ignored.
- “Google generally caches the contents of robots.txt file for up to 24 hours”.
The robots meta tag documentation adds the point that matters most in practice: if robots.txt blocks a page, Google cannot see the noindex on it, so that noindex is ignored.
Where the file lives
The file must sit at the root of the host and be called exactly robots.txt: https://example.com/robots.txt. A file at https://example.com/pages/robots.txt is not read.
Its scope is narrow. Because rules apply only to the host, protocol and port where the file is served:
https://example.com/robots.txtcovershttps://example.com/only.- Each subdomain needs its own file:
https://blog.example.com/robots.txt. The file onexample.comdoes not apply toblog.example.com. http://andhttps://, or a non-standard port such as:8080, are separate scopes too. In practice you redirecthttptohttpsand maintain one file per host.
The file must be “a UTF-8 encoded plain text file”, and Google reads only the first 500 KiB. If yours is close to that size, it is almost always full of rules you can replace with a few wildcards.
Syntax: user-agent, disallow, allow, sitemap
A robots.txt file is a list of groups. Each group starts with one or more User-agent lines and is followed by the Disallow and Allow rules for those crawlers. Sitemap lines stand on their own and do not belong to any group.
# Rules for every crawler without a group of its own
User-agent: * 1
Disallow: /search 2
Allow: /search/help 3
Disallow: /*?sort=
Disallow: /cart/
# OpenAI's training crawler: a separate group
User-agent: GPTBot 4
Disallow: /
Sitemap: https://example.com/sitemap.xml 5
- 1Group start.
*matches any crawler that has no more specific group in the file. - 2Disallow. The path starts with
/and is case-sensitive./searchalso blocks/search?q=shoesand/search-tips. - 3Allow. A longer, more specific path wins, so the help page stays crawlable while the rest of
/searchis blocked. - 4A crawler-specific group. GPTBot follows only this group and ignores the
*group entirely. - 5Sitemap. A full URL, outside any group. You can list several sitemaps.
Fields Google understands
user-agent: which crawler the group is for.*means all crawlers.disallow: a path the crawler should not fetch. An emptyDisallow:blocks nothing.allow: a path the crawler may fetch, used to open up part of a blocked folder.sitemap: the full URL of an XML sitemap.
Everything else is ignored by Google. Crawl-delay is the common example: some other search engines read it, Google does not. A Noindex: line in robots.txt does nothing either.
Groups for several crawlers
Google's documentation says: “You can group together rules that apply to multiple user agents by repeating user-agent lines for each crawler.” So this is one valid group that applies to both crawlers:
User-agent: GPTBot
User-agent: CCBot
Disallow: /
The key rule to remember: a crawler obeys only the most specific group that matches its name. If you add a User-agent: Googlebot group, Googlebot stops reading the * group, so any rule you still want for Googlebot must be repeated inside its own group.
Wildcards and matching rules
Rules match the start of the URL path, and Google supports two special characters:
- “* designates 0 or more instances of any valid character.”
- “$ designates the end of the URL.”
Google also states that “The path value must start with / to designate the root and the value is case-sensitive.” /Admin/ and /admin/ are different paths.
When several rules in a group match the same URL, Google uses “the most specific rule based on the length of the rule path”. If rules conflict, “Google uses the least restrictive rule.” In practice: the longer path wins, and when two matching rules are equally specific, Allow beats Disallow.
Worked examples:
| Rule | Blocks | Does not block |
|---|---|---|
Disallow: /blog | /blog, /blog/, /blog-news, /blog.html | /Blog, /news/blog |
Disallow: /blog/ | Everything inside the folder: /blog/post-1 | /blog, /blog-news |
Disallow: /*.pdf$ | URLs that end in .pdf: /files/guide.pdf | /files/guide.pdf?v=2 |
Disallow: /*?sort= | /shoes/?sort=price | /shoes/, /shoes/?page=2 |
Disallow: (empty) | Nothing | Everything is allowed |
A missing file has the same effect as an empty rule: if /robots.txt returns 404, everything is allowed.
What to block and what never to block
Block URLs that waste crawling on pages nobody needs in search. Leave alone everything Google needs to render and understand the pages you want to rank.
✓ Good candidates to block
- Internal search results:
/search - Endless filter and sort combinations:
/*?sort= - Cart and checkout
- URLs with session IDs
- Admin areas (behind a login anyway)
✕ Never block
- CSS, JavaScript and images needed to render the page
- Pages you want removed with
noindex - The whole site on production:
Disallow: / - Pages you want indexed and listed in your sitemap
A whole-site Disallow: / usually arrives by accident: it protects a staging site and is copied to production at launch. Check the live file every time a new version of the site goes out.
robots.txt vs noindex
The two tools answer different questions. robots.txt answers “may you fetch this URL?”. noindex answers “may you show this page in search?”.
Combining them on the same URL does not work. A blocked page is never fetched, so Google never sees its noindex, ignores it, and may keep the URL in the index without a snippet. If you want a page out of search, let Google crawl it with noindex in place.
| Goal | Use |
|---|---|
| Stop crawling of low-value URLs, such as internal search or sort parameters | robots.txt Disallow |
| Remove a page from search results | noindex (meta tag or X-Robots-Tag), page left crawlable |
| Consolidate duplicates on one URL | 301 redirect or rel="canonical", not robots.txt |
| Keep content private | Password or other authentication |
AI crawlers: who is who
AI companies publish their own user-agent tokens, and you address them in robots.txt exactly like Googlebot. The important detail is that one company often runs several bots with different jobs: blocking a training crawler is not the same as leaving an AI search product.
| Token | Company | Purpose | Effect of blocking |
|---|---|---|---|
Googlebot | Crawls for Google Search, including AI Overviews and AI Mode | Pages drop out of Google Search. Do not block it. | |
Google-Extended | Controls whether content is used for Gemini models | No effect on Search, ranking, AI Overviews or AI Mode | |
GPTBot | OpenAI | Collects content for model training | Opts your content out of OpenAI training |
OAI-SearchBot | OpenAI | Finds pages for ChatGPT search results | Can remove you from ChatGPT search answers |
ChatGPT-User | OpenAI | Fetches a page when a user asks ChatGPT to | Affects user-requested visits; check OpenAI's docs for how robots.txt applies |
ClaudeBot | Anthropic | Anthropic's web crawler | ClaudeBot stops crawling your site |
PerplexityBot | Perplexity | Indexes pages for Perplexity's answers | Can remove you from Perplexity answers |
CCBot | Common Crawl | Builds open web datasets, widely used for AI training | Pages are left out of future Common Crawl crawls |
Check the providers' pages before you copy rules. AI companies add, rename and redefine crawler tokens. Each provider documents its current tokens, and only its own page tells you what blocking one actually changes. Blocking also works only from now on: it does not remove content a crawler has already collected.
Google: Googlebot and Google-Extended
Googlebot crawls for Google Search. Google-Extended is a robots.txt token that controls whether your content is used for Google's Gemini models. Google states that it does not affect inclusion or ranking in Google Search.
AI Overviews and AI Mode are part of Search and use Googlebot, so blocking Google-Extended does not remove your site from them. The only way out of those features via robots.txt would be to block Googlebot, which removes you from Search as a whole.
# Keep content out of Gemini models, stay in Google Search
User-agent: Google-Extended
Disallow: /
OpenAI: GPTBot, OAI-SearchBot, ChatGPT-User
OpenAI separates its bots by job. GPTBot is for model training, OAI-SearchBot for ChatGPT search results, and ChatGPT-User fetches pages when a user asks ChatGPT to open them. Blocking OAI-SearchBot can remove you from ChatGPT search answers, so most sites that want to opt out of training block only GPTBot:
# Opt out of training, stay visible in ChatGPT search
User-agent: GPTBot
Disallow: /
User-agent: OAI-SearchBot
Allow: /
Anthropic: ClaudeBot
Anthropic's crawler uses the token ClaudeBot. Check Anthropic's documentation for what it collects and whether other Anthropic agents use separate tokens.
User-agent: ClaudeBot
Disallow: /
Perplexity: PerplexityBot
PerplexityBot indexes pages for Perplexity's answer engine. Blocking it can remove your pages from Perplexity answers, which is a traffic source for some sites, so decide deliberately.
Common Crawl: CCBot
CCBot builds Common Crawl's open web datasets, which are widely used for AI training. Blocking it keeps your pages out of future crawls. It cannot take them out of datasets that were already published.
How errors in robots.txt affect crawling
What Google does depends on the HTTP status code the file returns:
| Response for /robots.txt | What Google does |
|---|---|
| 200 with valid content | Applies the rules. |
| 4xx, such as 403 or 404 (except 429) | Google treats “all 4xx errors, except 429, as if a valid robots.txt file didn't exist”. There are no crawl restrictions. |
| 5xx and 429 | For the first 12 hours Google stops crawling the site but keeps trying to fetch robots.txt. After that, if it still cannot get a new version, it uses the last good version for up to 30 days. After 30 days, handling depends on whether the rest of the site is generally available. |
Two practical consequences. A server error on robots.txt can stop crawling of your whole site, so monitor it like any important page. And a 403 on robots.txt, often caused by a firewall or bot protection, does not block anything: Google reads it as “no rules”.
Because Google generally caches the file for up to 24 hours, a fix may take up to a day to be picked up.
Testing and monitoring
- Open the file in a browser at
https://example.com/robots.txtand check that it returns 200 and the content you expect, on every host and subdomain. - Check the robots.txt report in Search Console. It shows the versions Google fetched, when, and any errors or warnings it found.
- Test key URLs with URL Inspection. It shows whether a URL is blocked by robots.txt. Test your main templates: home, category, product, article.
- Watch the Page indexing report. The status Indexed, though blocked by robots.txt lists URLs Google indexed without crawling them. If you want them in search, unblock them. If you want them gone, unblock them and add
noindex. - Compare robots.txt with your sitemap. A sitemap should not list URLs that robots.txt blocks. That is a contradictory signal.
Check your robots.txt
The OurSEO Tools checklist checks your robots.txt and flags URLs that your sitemap lists but robots.txt blocks, so you can spot conflicting signals in one run.
Common mistakes
- ✕
Disallow: /left over from stagingThe production site blocks every crawler. Check the live file after each launch. - ✕Blocking CSS, JavaScript or imagesGoogle cannot render the page the way users see it.
- ✕Using robots.txt to remove pages from the indexA blocked URL can stay indexed. Use
noindexon a crawlable page instead. - ✕
Noindex:inside robots.txtNot a supported field. Google ignores it. - ✕
Crawl-delayfor GoogleNot supported by Google, so it has no effect on Googlebot. - ✕Wrong letter case in paths
Disallow: /Admin/does not block/admin/. - ✕A Googlebot group that silently overrides
*A crawler follows only its most specific group. Once aGooglebotgroup exists, rules in the*group no longer apply to Googlebot unless you repeat them. - ✕Blocking an AI search bot by mistakeBlocking
OAI-SearchBotorPerplexityBotwhen you only meant to opt out of training.
FAQ
Can I use robots.txt to remove a page from Google?
No. robots.txt blocks crawling, not indexing, and a blocked URL can still be indexed without a snippet. Leave the page crawlable and add noindex.
Does blocking an AI crawler remove my site from AI answers?
It depends on the token. Blocking GPTBot opts you out of OpenAI training, while blocking OAI-SearchBot can remove you from ChatGPT search. Blocking Google-Extended keeps content out of Gemini models but does not affect Google Search, AI Overviews or AI Mode. Check each provider's current documentation, as tokens change.
How long until Google sees my changes?
Google generally caches robots.txt for up to 24 hours, so allow up to a day. The robots.txt report in Search Console shows when Google last fetched the file.
What happens if robots.txt returns 404?
Google treats it as if there were no file, so everything may be crawled. A 5xx error is different: Google pauses crawling of the site at first.
Can I use wildcards?
Yes. Google supports * for any sequence of characters and $ for the end of the URL. Disallow: /*.pdf$ blocks URLs that end in .pdf.
Do all bots obey robots.txt?
No. Following it is voluntary. Major search engines and well-behaved bots respect it, but it is not access control. Protect private content with authentication.
Sources
- Google Search Central — How Google interprets the robots.txt specification
- Google Search Central — Robots meta tag, data-nosnippet and X-Robots-Tag specifications
- Google Search Central — Overview of Google crawlers and fetchers
Quotes checked against the official pages on 29 October 2026.