robots.txt is a plain text file at the root of a website, such as https://example.com/robots.txt, that tells crawlers which paths they may and may not fetch. It implements the Robots Exclusion Protocol, defined by Martijn Koster in 1994 and standardized by the IETF as RFC 9309 in September 2022.
How it works
The file contains groups. Each group starts with one or more user-agent lines naming crawlers, followed by allow and disallow rules for URL paths:
User-agent: GPTBot
Disallow: /
User-agent: *
Disallow: /checkout/
A crawler follows the group that matches its name, or the * group if none does. When several rules match a URL, the most specific one wins, meaning the longest match. Under RFC 9309, crawlers should not use a cached copy for more than 24 hours, must parse at least 500 KiB, may crawl freely if the file returns a 4xx error, and must assume everything is disallowed if it returns a 5xx error.
Limits
The RFC says plainly that the rules “are not a form of access authorization.” Compliance is voluntary. Search engines and AI companies document the tokens their crawlers obey, but scrapers can ignore the file, and any crawler can claim any name in its User-Agent. Enforcing a policy takes bot management and verified bot checks.
The IETF’s AI Preferences working group is drafting a Content-Usage rule for robots.txt, to state how content may be used, for example for AI training. It is still a draft.
See charging AI crawlers and the AI crawler blocking rankings.
Check how any site’s robots.txt treats 46 AI and search bots with the robots.txt checker, which also generates rules, and see which AI crawlers big websites block.