robots.txt tester
Paste a site's robots.txt, the crawler's name and the paths to test: the page finds the group the crawler follows, the rule that decides each path, and why, by the rules of RFC 9309. It reads only what you paste: nothing is fetched and nothing leaves your browser.
| Path | Result | Rule | Why |
|---|
How a crawler reads the file
| Step | What the crawler does |
|---|---|
| Groups | A group is one or more user-agent lines followed by rules, and it ends at the next user-agent line or the end of the file. A group without rules lets the crawler fetch everything. A Sitemap line or another record the protocol does not define does not end a group; a rule before the first user-agent line is in no group, and crawlers should ignore it. |
| Which group | A crawler looks for groups that name its product token, a name of letters, "_" and "-", matched without regard to case. Several groups that name it are merged into one. With none, it follows the "*" group; with no "*" group either, no rule applies to it. |
| Which rule | Each allow and disallow path is matched against the start of the path being fetched, case by case. The rule with the longest match wins; when an allow rule and a disallow rule match equally, allow wins. When no rule matches, the path is allowed, and /robots.txt itself always is. |
| Special characters | * in a rule stands for any run of characters, the slash included; $ at its end means the path must end there; # starts a comment. To match a real * or $ in an address, write it %2A or %24 in the rule. |
| Encoding | Characters outside ASCII are compared in their %-encoded form, and %-forms of letters, digits and - . _ ~ as the characters themselves. |
| Empty rules | Disallow: with no path blocks nothing, and Allow: with no path allows nothing more: Google's parser, the one Googlebot uses, gives a rule with no path no effect, and this page does the same. |
When the file is fetched
| Case | What the crawler does |
|---|---|
| The file | At /robots.txt, all lower case, at the top of the site; UTF-8 text, served as text/plain. |
| 2xx, read | The crawler follows the rules it can parse; a line it cannot parse is skipped. |
| 3xx redirect | The crawler should follow at least five redirects in a row, to another host too, and apply the file it reaches to the site it first asked. After more than five it may treat the file as unavailable. |
| 4xx, unavailable | The crawler may fetch anything on the site. |
| 5xx or a network error, unreachable | The crawler must take everything as disallowed. After a long time, such as 30 days, it may treat the file as unavailable or keep using a copy it cached. |
| Caching | A crawler should not use a cached copy for more than 24 hours, unless the file is unreachable. |
| Size | A crawler must read at least the first 500 KiB of the file. |
The rules ask crawlers to stay away; they do not stop anyone. A path listed in robots.txt is public for anyone to read, so a path that must stay private needs real protection, such as HTTP authentication.
Sources
- The protocol: RFC 9309, Robots Exclusion Protocol (September 2022), sections 2.1 to 2.5; the example: its section 5.1.
- What a rule with no path does, how a tie is settled in code, and how a user-agent value with other characters is read: Google's robots.txt parser and matcher, the production code Googlebot uses (google/
robotstxt at commit 22b355f, robots.cc), under the Apache License 2.0.
More Web tools
-
SAML response decoder
A SAMLResponse or SAMLRequest decoded in your browser: issuer, status, NameID, audience, times and attributes.
-
Content-Security-Policy checker
What each directive of a policy allows, what falls back to default-src, the gaps, and the Apache and nginx lines.
-
TLS cipher suite lookup
0xC02F, its IANA name and its OpenSSL name, IANA's Recommended mark, and Windows' default order.
-
Redirect rule generator
Apache and nginx rules for HTTP to HTTPS, www to the bare domain and old paths to new, with 301 or 308.