Guide
How Google parses robots.txt — and where our validator was wrong
Published
The short answer
* group. Groups that name the same crawler are combined; our validator read only the first. The longest matching path wins, and a tie goes to Allow. A group ends at the next User-agent after a rule, not at a blank line.On this page
There is a right answer, and it is runnable
robots.txt has a standard, RFC 9309, written in 2022 by engineers at Google with Martijn Koster, who wrote the original robots.txt in 1994. Google also publishes the C++ parser it uses in production (github.com/google/robotstxt), with a command-line tool that takes a file, a crawler name and a URL, and answers allowed or not. That makes it something rare in SEO: a claim you can check rather than argue about.
Our validator was written from the RFC and tested against our own reading of it. On 23 September 2026 we wrote 61 cases by hand — the shapes we had seen in live files — and asked both parsers. Seventeen verdicts differed, and in every one of them Google was reading the standard correctly and we were not. The fixture is now 72 cases, each answer recorded from Google's binary, and the test fails the day our parser stops agreeing. We also generated 21,000 random files and 30 real ones and found no further disagreement.
Four rules carry nearly every verdict
1. A crawler that is named stops reading the wildcard group
A crawler looks for groups whose User-agent names it. If any do, those are the only groups it reads; the User-agent: * group is no longer about it. Only a crawler nothing names falls back to *. This is the rule behind the most common silent change on a site: adding User-agent: GPTBot with one line under it, and thereby releasing GPTBot from every rule the site had written for everyone.
User-agent: *Allow: /Disallow: /hooks/Disallow: /app/Disallow: /api/Disallow: /sso/# … 24 Disallow lines in all …User-agent: GPTBotUser-agent: OAI-SearchBotUser-agent: ClaudeBotUser-agent: Google-ExtendedUser-agent: PerplexityBotAllow: /Read on 6 October 2026. The wildcard group disallows 24 paths, including /api/, /app/ and /sso/. The nine AI crawlers in the second group get none of them: their group says Allow: /, and that is all they read. Whether that is what was intended is not for us to say — it may well be — but a parser has to say it is what the file does.
2. Groups that name the same crawler are one group
RFC 9309 §2.2.1: if several groups name the same crawler, their rules are combined. Our validator got this one wrong. It took the first group that matched, which is what the 1996 draft before the RFC told crawlers to do, and what many parsers still do.
User-agent: GPTBotDisallow: /private/User-agent: GPTBotAllow: /private/help/GPTBot's rules here are both lines. /private/data is blocked and /private/help/faq is open. A first-group parser says /private/help/ is blocked; a last-group parser says /private/data is open. Both are wrong, in opposite directions, on a file that looks like it was edited twice by two people — which is most files older than a year.
3. The longest matching path wins; a tie goes to Allow
Within the rules a crawler reads, order does not matter. Of the rules that match the URL, the one with the longest path wins, counting the path as written, wildcards included. When an Allow and a Disallow are the same length, Allow wins. A Disallow: / followed by Allow: / is therefore an open site, and a file that says Allow: / then Disallow: /* is a closed one, because /* is two characters.
User-agent: *Disallow: /blogAllow: /blog/public/blog/public/a is open and /blog/private is blocked, and swapping the two lines changes nothing.
4. A group ends after a rule, not at a blank line
A group is one or more User-agent lines followed by rules. It ends when, after at least one Allow or Disallow, the next User-agent line begins. Blank lines do not end it. Comments do not. Neither does Sitemap:, nor Crawl-delay:, nor any line the parser does not recognise. The consequence is a trap we had not seen described anywhere before the parity run turned it up.
User-agent: baiducrawl-delay: 1User-agent: *Allow: /*?tab=achievements&achievement=*Disallow: /*/*/pulseRead on 6 October 2026. The baidu group contains only a Crawl-delay, which is not a rule, so the group has not ended when User-agent: * arrives two blank lines later. Google reads one group naming both, and baidu gets every wildcard rule. Here that is harmless, and probably what GitHub wanted. Put a User-agent: Googlebot with only a Crawl-delay above an AI section that says Disallow: /, and Googlebot is locked out of the site. Python's urllib.robotparser ends groups at blank lines and reads the same file the other way.
Three parser mistakes that look fine on most files
Matching the crawler name as a substring
A User-agent value is a whole token, compared case-insensitively. Applebot does not name Applebot-Extended; Claude does not name ClaudeBot. Our old parser matched substrings, as the 1996 draft told crawlers to, and that cost us four wrong verdicts on live sites. pinterest.com and booking.com have a group for Applebot, which we read as Applebot-Extended's. amazon.com has one for omgili, which we read as a block on Omgilibot, and en.wikipedia.org one for Fetch, which we read as a block on Meta's meta-externalfetcher. Each of the three is unnamed on its site, so it reads the wildcard group. (All four groups are still there on 21 October 2026.)
Taking the first group that matches
The combined-groups rule above, seen in the wild. This one costs a verdict in the dangerous direction.
User-Agent: *User-Agent: ChatGPT-UserUser-Agent: OAI-SearchBotUser-Agent: Google-ExtendedUser-Agent: PerplexityBotDisallow: /AddListingDisallow: /ShowUserReviews# … 650 more lines of this group …User-Agent: Google-ExtendedDisallow: /Allow: /Restaurants-g55711-Dallas_Texas.htmlRead on 6 October 2026. Google-Extended, the token that controls whether pages feed Gemini, is named near the top in a group it shares with * and seven other crawlers, and again at the bottom with Disallow: / and one Allow. A first-group parser reports the top group and calls Google-Extended free to read nearly the whole site. Google combines both and reads Disallow: /: Google-Extended is shut out of everything except the paths an Allow line names, one of which is a single Dallas restaurants page. Our checker gave the friendly answer for its first nine days online.
Splitting groups at blank lines
The github.com case above. It reads correctly on almost every file, because almost every group has a rule in it. Then a group with only a Crawl-delay or a Sitemap line arrives, and the verdict flips without anyone noticing.
Letting one crawler in means copying the carve-outs too
Rule 1 matters to anyone editing a file, not only to parsers. A crawler that is named reads nothing from the * group, so the safe way to let one in is to repeat the wildcard rules inside its group, under Allow: /. The longest match keeps each repeated rule winning where it applies. What gets left behind is the Allow lines. A carve-out is an Allow inside a Disallow, and WordPress's default file has one. A group that copies the Disallow without it closes a path for that one crawler that every other crawler can still fetch.
User-agent: *Disallow: /wp-admin/Allow: /wp-admin/admin-ajax.phpUser-agent: GPTBotAllow: /Disallow: /wp-admin/GPTBot is kept out of /wp-admin/, as intended. It is also kept out of /wp-admin/admin-ajax.php, which WordPress opens on purpose because themes and plugins call it to load parts of a page. The Allow that opened it is still there, in a group GPTBot no longer reads. Our own generator wrote this group until 23 September, when a reader asked about the shape. It now carries every Allow along with the Disallow it carves out of.
User-agent: GPTBotUser-agent: OAI-SearchBotUser-agent: ClaudeBotUser-agent: anthropic-aiUser-agent: PerplexityBotCrawl-delay: 1Allow: /*?tab=achievements&achievement=*Allow: /marketplace/*?tab=readme$Allow: /marketplace/*?tab=transparency$# … the wildcard group's Disallow lines …Disallow: /*?tab=*User-agent: AdsBot-GoogleUser-agent: AdsBot-Google-Mobile# … the same Disallow lines, and no Allow …Disallow: /*?tab=*Read on 21 October 2026. GitHub's wildcard group carves the achievements tab and two Marketplace tabs out of Disallow: /*?tab=*. GitHub repeats its rules for two named groups. It has to for AdsBot-Google, which ignores the * group whatever a file says. The AI group carries the three Allow lines. The AdsBot group copies the Disallow lines without them, so Google's ads crawler cannot fetch an achievements page that every unnamed crawler can. When we read the file on 23 September, the AI group was missing them too. Both may be deliberate, but a rule kept in several copies is changed one copy at a time, and nothing in the file says which copies are behind.
The AI crawler checker reports both directions on a live file: the paths a named group opened, and the carve-outs it closed. The AI robots.txt generator carries both when it lets a crawler in.
Where Google reads more than the RFC, and the one place we do not follow
Google's parser is forgiving about how a line is written. A byte-order mark before the first line is skipped. A bare carriage return counts as a newline. Dissallow:, Useragent: and a few other misspellings it has seen often enough are read as the directive they meant. A missing colon is read if there is whitespace where it should be. We read every one of these the same way, and flag the line, because a crawler that is stricter than Google will read the file differently and the author should know.
One Google-only rule we deliberately do not copy: Allow: /index.html is read by Google as also allowing /, so that a homepage is not blocked by its own Disallow: /. The RFC does not say this, and nothing says the AI crawlers do it. Copying it would mean telling a site its homepage is open to crawlers that may well be reading Disallow: / there. On every rule where we have a choice, we choose the reading that errs towards “blocked”, because “you are fine” is the one wrong answer that guarantees the rest of the work is wasted.
Thirty large sites, five wrong verdicts
After the fix we re-read the robots.txt of 30 large sites with both parsers. The old one had given five wrong verdicts, each on a different site: tripadvisor.com's from taking the first group, and the four substring cases above. On tripadvisor and pinterest it said “allowed” where Google's parser says blocked: pinterest's wildcard group says Disallow: /, and that, not the Applebot group, is the one Applebot-Extended reads. On amazon and Wikipedia it went the other way, shutting a crawler out with a group that was never about it. The friendly kind is the one that costs a site its answers, because nobody goes looking for a block the checker said was not there.
The robots.txt validator now names, for every crawler and any path you test, the group it matched — two groups that name it are read as one, and it says so — and the rule that decided. The AI crawler checker applies the same parser to a live file. If either disagrees with Google's binary on a file of yours, send us the file: the fixture gets a case and the test gets a verdict that is Google's to give, not ours.
Discuss this post with AI
Opens your assistant with a question about this post, ready to send.
Questions
- Do the AI crawlers parse robots.txt the way Google does?
- Nobody outside those companies can check. What we can say: Google's library comes from the Google engineers who co-wrote RFC 9309, the robots.txt standard, and on the cases where Google reads more than the RFC strictly asks, we read the file the same way and flag the line. The one Google-only rule we did not copy errs on the friendly side, which is the dangerous side for this job.
- Does the order of groups matter?
- Not for which group applies: a crawler collects every group that names it, wherever they sit, and reads them as one. Not for which rule wins either: the longest matching path wins regardless of position. A parser that takes the first group it finds, or the first rule that matches, will be right on most files and wrong on exactly the ones that were edited twice.
- Does a blank line end a group?
- No. A group ends when a rule line (Allow or Disallow) has been read and the next User-agent line begins. Blank lines, comments, Sitemap lines and Crawl-delay do not end one. Python's urllib.robotparser ends a group at a blank line, which is why it reads the Crawl-delay case on this page the opposite way from Google.
- What does Crawl-delay do?
- Google ignores it. A few crawlers honour it — Anthropic documents it for ClaudeBot — and where they do it only slows them down; it never keeps one out. Its real effect on a file is the one above: it does not end a group, so a group with nothing but a Crawl-delay in it swallows the rules of the next one.
- My file names a bot and * in the same group. Which rules does the bot get?
- That group's, plus any other group that names it. That is the tripadvisor shape above: Google-Extended is in a nine-agent group at the top and in its own group at the bottom, and it gets both. What it does not get is a group that names only *, because once anything names a crawler, the * group is no longer about it.
- How do I let one crawler in without losing my other rules?
- If no group names it and the * group lets it in, write nothing: naming it is what loses the rules. Otherwise give it a group that starts with Allow: /, then repeats every Disallow line of the * group except a blanket Disallow: /, then every Allow line that carves something out of those. The longest match keeps each repeated rule winning where it applies. The AI robots.txt generator writes that group from your live file.
- How do I check my own file?
- Paste it into the robots.txt validator. It reads the file the way described here, flags the lines that do nothing, and tests a path against Googlebot, Bingbot and every AI crawler, naming for each the group it matched and the rule that decided. If it disagrees with Google's parser on a file, that is a bug and we would like the file.