Google enforces a robots.txt file size limit of 500 KiB, and it ignores any content after that point [3]. Any rule sitting past the cutoff does not count for Google, so a block or allow you wrote there may do nothing. RFC 9309 sets a floor, not a ceiling: other crawlers may parse more or less than Google does, and you cannot assume they match.
What the documents say
| Source | What it says | Marker |
|---|---|---|
| RFC 9309 | Crawlers SHOULD impose a parsing limit, and that limit MUST be at least 500 KiB | [1] |
| Google robots.txt specification | Google enforces a 500 KiB limit; content after the maximum size is ignored | [3] |
| Google crawling documentation | Individual Google crawlers may have different size limits for different resource types | [2] |
| OpenAI crawler documentation | Documents robots.txt controls for OAI-SearchBot and GPTBot; the two settings are independent | [6] |
| Anthropic transparency page | Says its crawler follows industry-standard practices with respect to robots.txt | [7] |
Read the RFC line carefully. 500 KiB is the lowest limit a crawler is allowed to impose, so it is the lowest documented floor, not a universal ceiling. It does not guarantee that every crawler parses a file of any size, and it does not say that a larger file is safe elsewhere.
The OpenAI and Anthropic pages we retrieved say their crawlers respect robots.txt. They do not state a file size limit [6][7]. As far as public documentation goes, the limit for those crawlers is unknown. That is a reason to keep the file well under 500 KiB, not a reason to assume a larger limit.
Step 1: Measure the file in bytes
500 KiB is 512,000 bytes (500 × 1,024). Measure what your server actually returns, not the file in your repository, because a CDN, plugin or rewrite rule may serve something different.
curl -sL -o robots.txt -w "status=%{http_code} bytes=%{size_download}\n" https://example.com/robots.txt
wc -c robots.txt
If the byte count is under 512,000, this article's problem does not apply to Google. If it is over, continue.
Step 2: Find where the cutoff falls
Slice the file at the byte offset. Google's documentation, not the command, is the basis for treating the second slice as ignored [3]. The commands only show you where the line falls.
# Last lines inside the first 500 KiB
head -c 512000 robots.txt | tail -n 5
# What sits after the cutoff
tail -c +512001 robots.txt | head -n 20
The line at the boundary is probably cut mid-rule. We found no documentation in our sources on how Google treats a partial line at the cutoff, so treat that line as unreliable.
Step 3: List the groups that fall past the cutoff
The question that matters is which User-agent groups, and which rules inside them, sit beyond byte 512,000. This script prints each User-agent line that starts after the cutoff.
LC_ALL=C awk '{ if (/^[Uu]ser-agent:/ && off >= 512000) print NR": "$0; off += length($0) + 1 }' robots.txt
It assumes one-byte line endings (LF); with CRLF files the offsets run slightly low. If the output is empty but the file is oversized, the overflow is rules inside a group that started earlier. Check the tail of the file for Disallow and Allow lines that belong to groups you care about, such as the ones controlling AI crawlers.
If a group for GPTBot, OAI-SearchBot, ClaudeBot or similar lands past the cutoff, Google ignores it. Whether another crawler applies that rule is a separate question, and the crawler's own documentation has to answer it. For how to read those groups, see how to check if AI can crawl your website.
Step 4: See what is taking the space
Before cutting anything, find out what the bulk of the file is. Common causes vary by site, so count instead of guessing.
# Lines by directive
cut -d: -f1 robots.txt | sort | uniq -c | sort -rn | head
# Rules by first path segment
grep -i '^disallow:' robots.txt | awk -F/ '{print "/"$2}' | sort | uniq -c | sort -rn | head -20
# Exact duplicate lines
sort robots.txt | uniq -d | head
Large clusters under one path prefix are candidates for consolidation. Exact duplicates can be deleted without changing meaning.
Step 5: Shrink the file
Google's specification says oversized files can be reduced by consolidating rules and, for example, moving excluded material into a separate directory [3]. In practice:
- Move content under one path. If hundreds of
Disallowlines point at individual files, putting those files in one directory lets a single line cover them. This needs a site change, and the old URLs need to be handled, so plan it as a migration. - Delete exact duplicates and stale comments. These cost bytes and add no meaning.
- Merge repeated groups. If the same
User-agentappears in several groups, combine the rules into one group. - Do not reorder to dodge the cutoff. Moving a short group to the top does not fix truncation. The file is still oversized, and other crawlers may treat it differently. The safe fix is reducing the file size.
Do not delete a Disallow just to save bytes without checking what it covers. Compare the set of paths blocked before and after the edit.
Step 6: Verify
Search Console includes a robots.txt report that checks whether Google can process your robots.txt files [4]. Use it after deploying the smaller file. Our sources do not say it flags truncation specifically, so re-run the byte count from step 1 as well.
For AI crawlers, check your server logs after the change. OpenAI says it may take about 24 hours after a robots.txt update for its systems to adjust for search results [6]. Verifying GPTBot in your logs covers how to tell real requests from spoofed ones. A size check also belongs in your routine technical SEO checklist.
What to do next
- Run the
curlcommand and record the byte count of the live file. - If it is over 512,000 bytes, run the
awkscript and list every group past the cutoff. - Count rules by path prefix and consolidate the biggest clusters.
- Deploy, confirm in the Search Console report, and re-measure.
- Set an alert or a CI check that fails if
robots.txtexceeds a size you choose, well below 500 KiB.