How is it calculated?
The format is standardised as the Robots Exclusion Protocol in RFC 9309. The file is made of groups. Each group starts with one or more User-agent lines naming a crawler token, or * for all, followed by Allow and Disallow rules for URL paths. A crawler uses the group that names it most specifically and ignores the rest. Within that group the longest matching rule wins, and Allow wins a tie.
It controls crawling, not indexing. Google’s own robots.txt introduction says it is not a way to keep a page out of Google: a blocked URL can still appear in results if other pages link to it. Use noindex or a password for that, and leave the page crawlable so the noindex can be seen.
Example
With the file above, GPTBot matches its own group and may fetch nothing. Googlebot has no group of its own, so it uses *: it may not fetch /admin/settings, but it may fetch /admin/help, because the Allow rule is longer and more specific than Disallow: /admin/. Every other path is open.
Common mistakes
- Using it to hide a page from search. Disallowed pages can still be indexed from links. It also lists your private paths for anyone to read.
- Blocking every AI bot with one group. Training crawlers, search crawlers and user-triggered fetchers are different decisions, and blocking the last two can remove you from assistants’ answers.
- Blocking the CSS and JavaScript a page needs. A search engine that cannot load them may not render the page correctly.
- Expecting it to stop scrapers. Compliance is voluntary. To enforce a block, filter by verified IP or user agent at your server or CDN.