How big can a robots.txt file be?

By TechCompare · Updated · How we check

Keep robots.txt under 500 KiB (512,000 bytes). Google ignores what's past that point.

Google reads the first 500 kibibytes of a robots.txt file and ignores everything after that. That's 512,000 bytes. A normal file is a few hundred bytes, so most sites never see the limit. Generated files with thousands of URL rules can pass it, and the rules at the bottom then do nothing.

Topic
500 KiB size limit
File size
Category
Reading the rules
Precedence, wildcards and size

How it works

RFC 9309 sets the floor for how much a crawler must read, and Google enforces exactly that size. Another crawler may read more, so one crawler can read a long file whole while another cuts it. The tester reads the first 512,000 bytes of the file and flags it when there's more. It ignores everything after the cut, the way Google does, so a rule that sits past it never shows up as the reason for a verdict. The rules at the bottom of a long file are the ones at risk.

Verdict

If the file is near the limit, shorten it before a rule falls off the end. Use patterns in place of long lists, delete rules for pages that no longer exist, and recheck. A file under the limit shows no cut notice in the tester, and every rule in it counts.

More Robots.txt scenarios

Block GPTBot
Two lines tell OpenAI's training crawler to stay out. Its search crawler and its page visits use other names.
View details
Google-Extended
A token for Gemini training, not a crawler. A rule for it never reaches Googlebot or Google Search.
View details
Block AI, keep search
Name each training crawler, leave Googlebot and Bingbot alone, and choose on purpose about the AI search bots.
View details

Frequently asked questions

Is 500 KiB the same as 500 KB?
No. A kibibyte is 1,024 bytes, so 500 KiB is 512,000 bytes. 500 KB would be 500,000. Google's limit is in kibibytes.
Do other crawlers use the same limit?
RFC 9309 says a crawler's parsing limit must be at least 500 KiB, so that's the least any crawler reads. Some may read more. Keep the file under the limit and every crawler sees all of it.
Which rules are safe to remove?
Exact duplicates first, since a repeated line adds nothing. After that, replace lists of single URLs with one pattern. Compare a few paths in the tester before and after, and make sure the verdicts match.