Paths are matched from the start of the URL path, case-sensitively. * matches any run of characters, a trailing $ anchors the end. Crawl-delay is ignored by Google; Bing and Yandex read it.
Build a robots.txt file one rule group at a time,
block the AI training crawlers with one click, and check a path
against the result before you deploy it. The tester uses the same
longest-match rule as Google, so you see here that
/admin/help/ is still crawlable, instead of finding out
in Search Console weeks later.
Paths are matched from the start of the URL path, case-sensitively. * matches any run of characters, a trailing $ anchors the end. Crawl-delay is ignored by Google; Bing and Yandex read it.
The Example button produces a default group for every crawler, one group that blocks the AI training bots, and a sitemap line. Groups with identical rules are merged under several User-agent lines, which RFC 9309 allows.
User-agent: *
Allow: /admin/help/
Disallow: /admin/
Disallow: /cart
Disallow: /*?sort=
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
User-agent: CCBot
User-agent: Applebot-Extended
Disallow: /
Sitemap: https://example.com/sitemap.xml
First the crawler picks the group whose User-agent matches its own product token, case-insensitively. It falls back to * only if there is none. A named group replaces the * group; it does not add to it. For example, once you add a Googlebot group, the rules under * no longer apply to Googlebot, so repeat any you still need.
Inside the group, the order of lines does not matter. The crawler compares every Allow and Disallow that matches the path, and the longest pattern wins. On a tie, Allow wins. If nothing matches, the path is allowed.
/admin/help/faq Allow: /admin/help/ (12 chars) beats Disallow: /admin/ (7)
/admin/users Disallow: /admin/
/products?sort=price Disallow: /*?sort=
/products?page=2 no rule matches, allowed
/file.pdf Disallow: /*.pdf$ matches
/file.pdf?v=2 /*.pdf$ does not match: $ means "ends here" Use noindex to keep a page out of results. A disallowed URL can still be indexed, without a snippet, if other sites link to it. Allow crawling and serve noindex, or put the page behind a login.
The file is public and compliance is voluntary. Listing /secret-admin/ in it points anyone curious straight at that path. Well-behaved bots obey the file, and scrapers can read it for targets.
Google-Extended and Applebot-Extended never fetch anything. Googlebot and Applebot read them to decide whether your content may be used for AI training. Blocking them does not affect search.
The file at https://example.com/robots.txt does not cover www.example.com, http://, or another port. Each origin needs its own file.
// Longest match wins, Allow wins ties (RFC 9309, what Google does)
function toRegex(pattern) {
const anchored = pattern.endsWith("$");
const body = (anchored ? pattern.slice(0, -1) : pattern)
.split("*")
.map((s) => s.replace(/[.+?^${}()|[\]\\]/g, "\\$&"))
.join(".*");
return new RegExp("^" + body + (anchored ? "$" : ""));
}
function isAllowed(rules, path) {
let best = null;
for (const r of rules) {
if (!r.path || !toRegex(r.path).test(path)) continue;
if (!best || r.path.length > best.path.length ||
(r.path.length === best.path.length && r.allow)) best = r;
}
return best ? best.allow : true;
}
const rules = [
{ allow: false, path: "/admin/" },
{ allow: true, path: "/admin/help/" },
];
console.log(isAllowed(rules, "/admin/help/faq")); // true
console.log(isAllowed(rules, "/admin/users")); // false This covers only the matching step. A real crawler first picks the one group whose User-agent matches its token, and falls back to * only when none does.
from urllib.robotparser import RobotFileParser
rp = RobotFileParser()
rp.set_url("https://example.com/robots.txt")
rp.read()
print(rp.can_fetch("Googlebot", "https://example.com/admin/users"))
print(rp.crawl_delay("Bingbot")) # None when not set
print(rp.site_maps()) # list of Sitemap: URLs, or None
# Caution: robotparser applies rules in file order (first match wins)
# and does not understand * or $ inside paths, so results can differ
# from Google's for files that rely on either. For Google-accurate results in Python, use a parser that implements RFC 9309, such as Google's own C++ robotstxt library or a port of it.
# Is it there, and is it plain text?
curl -sI https://example.com/robots.txt | grep -iE "^(HTTP|content-type)"
# Read it as a crawler would
curl -s -A "Googlebot" https://example.com/robots.txt
# A 5xx here makes Google stop crawling the site for a while;
# a 404 means "no rules", so everything is allowed. RFC 9309 (2022) turned the 1994 convention into a standard. It fixes the details that used to differ between crawlers: records are grouped by consecutive User-agent lines, matching of the user agent is case-insensitive while matching of paths is case-sensitive, the most specific (longest) rule wins, and crawlers must parse at least 500 KiB of the file. Google stops reading after 500 KiB, so anything below that line is ignored.
Crawl-delay, Host and Noindex are not part of the standard, and Google ignores all three. Sitemap lines are also outside the RFC, but every major search engine reads them, and they apply to the whole file regardless of which group they appear in.
This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.
Add a group with Disallow: / for each bot's token: GPTBot (OpenAI), ClaudeBot (Anthropic), Google-Extended (Gemini training), CCBot (Common Crawl) and Applebot-Extended (Apple). The Block AI training crawlers button adds all five. Compliance is voluntary, so this stops only the companies that honor robots.txt.
No. Google-Extended is a token that Googlebot checks before your content is used to train Gemini models; nothing crawls under that name. Search crawling and ranking are unaffected. The same goes for Applebot-Extended and Apple's search features.
No. Googlebot ignores the Crawl-delay line and adjusts its rate from how fast your server responds. Bing and Yandex do read it, so set it when one of those bots is loading your server too hard.
The longest matching path wins, regardless of the order of the lines. If an Allow and a Disallow are the same length, Allow wins. That is the rule in RFC 9309 and what Google implements, and it is what the path tester on this page uses.
Not reliably. A disallowed URL can still be indexed without a snippet if other pages link to it. To keep it out of results, allow crawling and add a noindex meta tag or an X-Robots-Tag header, because Google has to fetch the page to see either.
Build the file your Sitemap line points at with the XML sitemap generator. To keep a
page out of search results instead of out of the crawl, the meta tag generator adds
noindex. To move URLs instead of blocking them, use the
redirect generator.