Quick answer
robots.txt is a plain-text file at the root of a host that tells crawlers which URL paths they should not fetch, using user-agent groups and allow/disallow rules defined in RFC 9309. It is a voluntary crawl directive: it does not block access and does not remove pages from search.
What is robots.txt?
robots.txt is a plain-text file at the root of a website that tells automated crawlers which URL paths they may and may not fetch. It implements the Robots Exclusion Protocol, first proposed in 1994 and published as an IETF standard, RFC 9309, in September 2022.
Two facts shape everything else on this page. First, the file is a request, not a lock: RFC 9309 states that the rules "are not a form of access authorization", and a crawler that ignores them still gets the page. Second, it controls crawling, not indexing. Google's own documentation says robots.txt is "not a mechanism for keeping a web page out of Google"; a blocked URL can still appear in results if other sites link to it, just without a description.
So the useful mental model is: robots.txt is a traffic sign for well-behaved bots. You use it to keep search engines and AI crawlers away from low-value or expensive URLs, and you verify compliance from your own server records, because the file itself proves nothing.
Where the file lives and what it contains
| Property | What RFC 9309 says | Practical consequence |
|---|---|---|
| Location | /robots.txt, all lowercase, at the top-level path of the service | example.com/robots.txt does not cover shop.example.com or http:// vs https://; each host and protocol needs its own file |
| Groups | One or more user-agent lines followed by allow and disallow rules | Rules belong to a group; there is no inheritance between groups |
| Agent matching | Case-insensitive match on the crawler's product token | googlebot and Googlebot are the same group |
| Wildcards | * means zero or more characters; $ anchors the end of the path | /*?sort= blocks any URL with a sort parameter; /*.pdf$ blocks PDFs |
| Size | Crawlers must parse at least 500 kibibytes | Rules past that point may be ignored; Google stops at 500 KiB |
| Redirects | Crawlers should follow at least five consecutive redirects | A redirect chain to the file longer than that may be treated as unavailable |
| Caching | Crawlers should not use a cached copy for more than 24 hours, unless the file is unreachable | A fix can take up to a day to be picked up |
Sitemap: lines are allowed and widely used, but they sit outside the core rules. Crawl-delay is not part of RFC 9309; some crawlers honour it, Google does not.
How a crawler picks a group and a rule
The matching logic has three steps, all from RFC 9309 section 2.2:
- Find the group. The crawler looks for the group whose
user-agentmatches its product token. If several groups match the same token, their rules are merged. Only if no group matches does it fall back to the*group. - Find matching rules. Every
allowanddisallowpath in that group is compared with the URL path, including the query string. - Pick the most specific rule. "The most specific match is the match that has the most octets", in plain terms the longest matching path. If an
allowand adisalloware equally long,allowwins. If nothing matches, the URL is allowed.
Here is a worked example file for a shop:
User-agent: Googlebot
Disallow: /checkout/
Allow: /checkout/help
Disallow: /*?sort=
User-agent: GPTBot
Disallow: /
User-agent: *
Disallow: /admin/
Disallow: /search
Allow: /search/help$
Each row below was checked with a small Python implementation of the longest-match rule:
| Crawler | URL path | Group used | Winning rule | Result |
|---|---|---|---|---|
| Googlebot | /checkout/help | Googlebot | Allow: /checkout/help (14 characters beats 10) | Allowed |
| Googlebot | /checkout/pay | Googlebot | Disallow: /checkout/ | Blocked |
| Googlebot | /shoes?sort=price | Googlebot | Disallow: /*?sort= | Blocked |
| Googlebot | /admin/ | Googlebot | None (the * group is not inherited) | Allowed |
| GPTBot | /blog/robots-guide | GPTBot | Disallow: / | Blocked |
| Bingbot | /search?q=boots | * | Disallow: /search | Blocked |
| Bingbot | /search/help | * | Allow: /search/help$ | Allowed |
| Bingbot | /search/help/returns | * | Disallow: /search (the $ stops the allow) | Blocked |
The fourth row is the mistake most sites make: once you write a named group for a crawler, that crawler ignores everything in User-agent: *. If /admin/ should be closed to Googlebot too, the line must be repeated inside the Googlebot group. Blocking an entire site is covered separately in robots.txt disallow all.
What happens when the file cannot be fetched
Crawlers fetch the file before crawling, and the HTTP status changes the outcome:
Status when fetching /robots.txt | RFC 9309 behaviour | What it means for you |
|---|---|---|
| 2xx | Parse and obey the rules | Normal case |
| 3xx | Follow at least five redirects, then treat the target as the file | Keep the redirect short and on the same rules |
| 4xx ("unavailable") | The crawler may access any resource | A missing file means "crawl everything", including a 403 |
| 5xx or network error ("unreachable") | The crawler must assume complete disallow | An outage on the file can stop all crawling |
| Unreachable for a long time (the RFC's example is 30 days) | The crawler may treat the file as unavailable or keep using its cached copy | A long outage can flip from "nothing" to "everything" |
The 4xx and 5xx rows run in opposite directions, which surprises people. Returning 403 to block a crawler from the file does not protect the site; it tells the crawler there are no rules.
What robots.txt cannot do
- It cannot stop a fetch. Any client can request a disallowed path. RFC 9309 says the protocol "is not a substitute for valid content security measures". Private pages need authentication.
- It cannot remove a page from search. A disallowed URL that is linked from elsewhere can be indexed with no snippet. To keep a page out of results, let it be crawled and serve
noindex. - It can expose what you hide. The file is public. Listing
/internal-reports/tells every reader where to look. - It cannot tell you who obeyed. The file has no reporting. Only access logs or server-side records show whether a crawler fetched a disallowed path.
robots.txt vs noindex vs X-Robots-Tag
| Control | Where it lives | What it controls | Crawler must fetch the page? |
|---|---|---|---|
| robots.txt | One file per host | Whether a URL is fetched | No, the URL is never requested |
<meta name="robots" content="noindex"> | Inside the HTML page | Whether the page is indexed | Yes, it has to read the tag |
| X-Robots-Tag | HTTP response header | Indexing for any file type, such as PDFs | Yes, it has to read the header |
The practical rule: if you disallow a URL in robots.txt, a noindex on that URL is never seen. Pick one job per URL: robots.txt for crawl load, noindex or X-Robots-Tag for search visibility.
Common mistakes
- Blocking CSS and JavaScript. Search engines render pages; blocking
/assets/can make pages look broken to them. - Assuming the
*group applies to named bots. See the Googlebot/admin/row above. - Using robots.txt to hide staging or private data. Use authentication; the file is a public list.
- Disallowing a page to de-index it. The page stays in the index without a snippet; serve
noindexinstead. - Forgetting subdomains.
blog.example.comandcdn.example.comeach need their own file. - Serving 5xx on the file during deploys. Per RFC 9309 that reads as "disallow everything" until the next successful fetch.
Checking whether crawlers obey robots.txt in TapCub
Take the example file above. You added Disallow: / for GPTBot and want to know whether the crawler respects it. In TapCub:
- Send server-side records. The page script only sees bots that run JavaScript and never sees status codes. Send access-log lines through the log import API (it keeps only requests classified as bots) or server events, so every crawler request is counted. See check crawl health.
- Open Monitoring › Crawler compliance. TapCub fetches your robots.txt and compares it with real fetches. It lists three violation types: fetched while blocked globally, fetched a path marked disallowed, and fetched sooner than the declared delay. A GPTBot row here is your evidence that the file was ignored. The page can also draft rules such as "block training crawlers" for you to publish; the file still cannot stop a fetch.
- Check the volume in Web analytics › Bots. The All bots tab lists each crawler's operator, purpose, requests, pages visited, most common status code and last-seen time, kept out of human visitor counts. Several tokens from one operator share a row.
- Watch search crawlers in Monitoring › Crawl health. Fetches, success rate, 404s and 5xx per engine show whether a rule change cut crawling of pages you still want indexed.
Adding a crawler to TapCub's exclusion rules only stops TapCub from counting it; to refuse requests you need a server or firewall rule.
Sources
- IETF, RFC 9309: Robots Exclusion Protocol, September 2022.
- Google Search Central, Introduction to robots.txt.
- Google Search Central, How Google interprets the robots.txt specification.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Customer Experience Consultant
Writes about live chat, visitor conversations, and self-service, sharing practical ways to make customer communication clearer and more effective.