robots.txt (the file that tells crawlers what to fetch)
What a robots.txt file is, where it goes, a five-line example, which rule wins, and what the file cannot do: it controls crawling, not indexing or access.
On this page
robots.txt is a plain text file at the root of a website that tells automated crawlers which URLs they may fetch; its rules are standardized as the Robots Exclusion Protocol in RFC 9309.
What robots.txt does#
Before a crawler fetches pages from a website, it requests one file: /robots.txt. The file lists groups of rules. Each group starts with one or more User-agent lines that name the crawlers it is for, followed by Allow and Disallow lines with URL paths. A crawler follows the group that names it. If no group names it, it follows the * group, and if there is none, no rules apply.
The method was first defined in 1994. Since September 2022 it is an IETF standards track document, RFC 9309, under the name Robots Exclusion Protocol (REP).
A five-line example#
User-agent: *
Disallow: /cart
Disallow: /checkout
Disallow: /account
Sitemap: https://www.example.com/sitemap.xmlThis tells every crawler to stay out of the cart, the checkout and the account pages. Everything else, including product and category pages, may be crawled. The last line points crawlers to the sitemap.
The rules in short#
| Detail | What applies |
|---|---|
| Location | /robots.txt at the top level of the host. It covers that host, protocol and port only. |
| Format | Plain text in UTF-8 |
| Lines | User-agent, Allow and Disallow are the standard. Google also supports Sitemap. |
| Which rule wins | The most specific match, which is the longest matching path. If an allow and a disallow rule match equally, allow is used. |
| Size | A crawler's size limit must be at least 500 kibibytes. Google ignores what comes after that. |
| Caching | Crawlers should not use a cached copy for more than 24 hours. Google generally caches the file for up to 24 hours. |
What robots.txt cannot do#
- It is not access control. RFC 9309 says the rules are not a form of access authorization. It also warns that every path listed in the file is public. Pages that must stay private need a login.
- It does not keep a page out of search. Google's introduction to robots.txt says the file is used mainly to manage crawler traffic and is not a mechanism for keeping a page out of Google. A blocked URL can still appear in results, without a description, when other pages link to it.
- It can hide a noindex rule. A crawler that may not fetch a page never sees the
noindexon it. Google's noindex documentation says the page must not be blocked by robots.txt for the rule to work. - It cannot force a crawler. Each crawler decides whether to follow the file.
robots.txt and AI crawlers#
AI companies use the same file. Each one documents the name its crawler listens to: GPTBot and OAI-SearchBot for OpenAI, ClaudeBot for Anthropic, PerplexityBot for Perplexity, and the Google-Extended token for Gemini. A shop can therefore decide per crawler, for example allow search crawlers and disallow training crawlers.
The guide to robots.txt for online shops has a complete file with comments and a block for each AI crawler. The AI crawler checker reads a shop's robots.txt and shows which AI crawlers may read it.
Questions
Does robots.txt keep a page out of Google?
No. Google says robots.txt is not a mechanism for keeping a web page out of Google. A blocked URL can still be indexed when other pages link to it. To keep a page out of search results, use noindex on a page crawlers can reach, or protect it with a password.
Where does the robots.txt file go?
At the top level of the host, for example https://www.example.com/robots.txt. It applies only to that host, protocol and port, so a subdomain such as shop.example.com needs its own file.
Do all crawlers follow robots.txt?
No. Following it is voluntary. RFC 9309 says the rules are not a form of access authorization. For fetchers that act on a user's request, OpenAI says the rules may not apply to ChatGPT-User, and Perplexity says Perplexity-User generally ignores them.
Sources
- RFC 9309: Robots Exclusion ProtocolIETFchecked 23 November 2026
- How Google interprets the robots.txt specificationGoogle for Developerschecked 23 November 2026
- Introduction to robots.txtGoogle Search Centralchecked 23 November 2026
- Block Search indexing with noindexGoogle Search Centralchecked 23 November 2026
- Overview of OpenAI CrawlersOpenAI developer docschecked 23 November 2026
- Perplexity CrawlersPerplexitychecked 23 November 2026
- ACP vs UCP vs MCP: agentic commerce protocols comparedComparisons
- Agentic commerceGlossary
- Agentic Commerce ProtocolGlossary
- AI crawlers and robots.txt: what online shops should allowGuides
- Conversational commerce: the product data AI assistants ask forGuides
- Generative engine optimizationGlossary
- Generative engine optimization (GEO) for online shopsGuides
- How to get your products into ChatGPT Shopping with a product feedGuides
- How to get your products shown in ChatGPT: what merchants controlGuides
- OAI-SearchBotGlossary
- PerplexityBotGlossary
- Universal Commerce ProtocolGlossary