Glossary

robots.txt

robots.txt is a plain text file at the root of a website that tells crawlers which paths they may and may not fetch, under the Robots Exclusion Protocol.

robots.txt is a plain text file, served at the root of a website (for example example.com/robots.txt), that tells automated crawlers which parts of the site they may fetch. It follows the Robots Exclusion Protocol, first proposed in 1994 and published as an internet standard, RFC 9309, in 2022. Search engines, archives, SEO tools and AI crawlers read the file before they request other pages, and well-behaved bots follow it. It is a request rather than a lock: nothing in the protocol stops a client from ignoring it, which is why it sits alongside, rather than in place of, real access control. For anyone running a web crawler or doing web scraping, checking robots.txt is the first and cheapest courtesy.

What a robots.txt file looks like

The file is a list of groups. Each group starts with one or more User-agent lines naming the crawlers it applies to, followed by Allow and Disallow rules that match URL paths. A short example:

Line

Meaning

User-agent: *

The group applies to any crawler without a more specific group

Disallow: /admin/

Do not fetch anything under /admin/

Disallow: /search

Do not fetch internal search result pages

Allow: /search/help

Except this help page, which may be fetched

User-agent: GPTBot

A separate group for OpenAI’s crawler

Disallow: /

That crawler may fetch nothing on the site

Sitemap: https://example.com/sitemap.xml

Where to find the list of pages the site wants crawled

A crawler uses only the group that best matches its own user agent token, so in the example above GPTBot follows its own group and ignores the rules under the wildcard. Within a group, the most specific matching rule wins, meaning the one with the longest matching path. If an Allow and a Disallow rule are equally long, RFC 9309 says the Allow rule should be used. Two pattern characters are supported: an asterisk matches any sequence of characters, and a dollar sign anchors a rule to the end of the URL, so Disallow: /*.pdf$ blocks PDF files without blocking pages that only mention PDF in their path.

The Sitemap line is not part of the core standard but is supported by the major search engines. It points to an XML sitemap and can appear anywhere in the file. Crawl-delay, which asks for a pause between requests, is also outside the standard; some crawlers honour it and Google’s does not.

Where the file lives and how crawlers read it

robots.txt applies to one origin: one scheme, host and port. The file at https://example.com/robots.txt says nothing about https://docs.example.com or http://example.com, each of which needs its own file. A crawler fetches the file before crawling, follows a limited number of redirects to reach it, and caches it. RFC 9309 says crawlers should not use a cached copy for more than 24 hours unless the file cannot be fetched, so a change to robots.txt takes effect within about a day for compliant crawlers.

The response code matters as much as the content. If the file returns a 4xx status such as 404, crawlers may treat the site as having no restrictions. If the server cannot be reached or returns a 5xx error, the standard tells crawlers to assume they may crawl nothing, since an error could hide a real restriction. This catches sites out: a misconfigured server that returns 500 for /robots.txt can stop search engines crawling the whole site. Crawlers are expected to parse at least the first 500 kibibytes of the file, so very long files may be cut short.

What robots.txt does and does not do

robots.txt controls crawling, meaning which URLs a bot requests. It does not control indexing, and it does not protect content. These are different jobs, and confusing them causes most robots.txt mistakes.

A page blocked in robots.txt can still appear in search results if other sites link to it, because the search engine knows the URL exists even though it never fetched it. To keep a page out of an index, the page must be crawlable and carry a noindex directive in a robots meta tag or an X-Robots-Tag response header. Blocking the page in robots.txt stops the crawler from seeing that noindex, which defeats it. Google stopped supporting noindex rules inside robots.txt in 2019.

robots.txt is also public. Anyone can read it, and listing private paths in it advertises them. Sensitive content needs authentication, not a Disallow line. Likewise, a crawler that ignores the file meets no technical barrier from the protocol itself. Sites that need to enforce limits use rate limiting, which returns HTTP 429 when clients go too fast, and anti-bot detection to identify and block clients that disguise themselves.

robots.txt and AI crawlers

Since 2023 robots.txt has become the main way site owners express a view on AI crawling. Model providers and AI search products publish user agent tokens for their crawlers, and site owners add groups for them. Common examples include GPTBot (OpenAI), ClaudeBot (Anthropic), CCBot (Common Crawl, whose data many models use) and PerplexityBot. Google uses a separate token, Google-Extended, that controls whether content Googlebot has crawled may be used for Gemini model training, without affecting Google Search. Token names and their exact meaning change, so check each provider’s current documentation rather than copying an old list.

There are a few distinctions worth keeping straight. Some tokens govern collection for model training, others govern fetching pages live in response to a user’s question, as deep research and agentic search tools do, and providers draw that line differently. An AI agent operating a headless browser on behalf of a user may or may not consult robots.txt, and practice varies by product. robots.txt also cannot express licensing terms, payment or attribution requirements; proposals such as llms.txt and various content-signal schemes try to fill that gap, and none is a settled standard yet. The debate is covered in should every website ship an llms.txt.

A worked example

Suppose you are building an agent that monitors 300 competitor and industry websites each week for competitive intelligence. Before any page is fetched, the crawler requests robots.txt for each origin, stores the parsed rules with a timestamp, and refreshes them at least daily. It identifies itself with a stable user agent string, such as AcmeMonitorBot/1.0, and a URL explaining what it is and how to contact you.

Across the 300 sites, you would typically find a mix: most allow general crawling but block search pages, carts and account areas; some block named AI crawlers but not unknown bots; a few block everything except search engines; and a handful return errors. A careful pipeline treats each case on its own terms. A site that blocks all crawlers except Googlebot has stated its position, and pretending to be Googlebot to get round it would be deceptive and is how crawlers end up blocked or in legal disputes. A site whose robots.txt returns 503 is treated as fully disallowed until the file can be fetched, and the crawler retries with exponential backoff rather than proceeding.

For the pages that remain allowed, the agent spaces its requests, respects any Crawl-delay, and fetches only what changed, using the sitemap’s lastmod values where available. The result is fewer blocked requests and fewer complaints, and a crawl log that can show, page by page, that each fetch was permitted when it happened. The figures in this example are illustrative.

Common mistakes

The most damaging mistake is a leftover Disallow: / from a staging site that ships to production, which asks every crawler to skip the entire site. Others recur often enough to check for. Blocking CSS and JavaScript files stops search engines rendering pages properly, which matters for sites that depend on JavaScript rendering. Using robots.txt to hide duplicate pages, instead of a canonical URL, wastes crawl budget without consolidating signals. Writing rules with the wrong case is easy to miss, since path matching is case-sensitive. And relying on a specific bot honouring Crawl-delay, when that bot ignores it, leaves the server unprotected.

On the crawler side, the usual mistakes are parsing the file loosely, applying the wildcard group when a specific group exists, ignoring the 5xx rule, and caching the file for weeks. Mature parsers exist for most languages, including the open-source parser Google publishes, and using one avoids most of these errors.

How it relates to other crawling and legal questions

robots.txt is one input to the question of whether a particular collection is acceptable, not the whole answer. Terms of service, copyright, data protection law and the purpose of the collection all matter, as covered in is web scraping legal. Where a site offers an API, using it is often cleaner than crawling at all, a trade-off covered in web scraping vs API. The difference between following links at scale and extracting data from specific pages is set out in web scraping vs web crawling, and preserving pages over time is a separate discipline described under web archiving.

Where Exabase fits

Exabase does not crawl the web on its own schedule. It fetches the specific public URLs that you or your agent submit, which keeps decisions about what to collect, and whether robots.txt and site terms permit it, with your team. Exabase provides the fetching and processing substrate, not the policy.

Once you have decided a page may be collected, Extract renders it with JavaScript, returns its title, site name and content as text chunks, and can return Markdown ready for a prompt, as described in the submitting jobs guide. Saving the URL as a bookmark in Resources stores the page with a reader-mode version and indexes it for Deep Search, so a research agent can find the passage it needs later. For URL metadata only, the Link Preview API fetches a page’s title, description and image synchronously, with the details in the link preview guide. A Worker can revisit an approved list of sources on a schedule, which suits the monitoring pattern above and the research agents use case. If your policy requires a fetcher to honour robots.txt itself, check that requirement with any service you use, Exabase included, before relying on it. For how Exabase compares with crawling services, see Exabase vs Firecrawl, Exabase vs Crawl4AI and the best web scraping APIs.

Frequently asked questions

Where is the robots.txt file located?

It must be at the root of the host, for example https://example.com/robots.txt. Each subdomain, scheme and port needs its own file, and a robots.txt in a subfolder is ignored.

Is robots.txt legally binding?

Not by itself. It is a voluntary protocol, though courts and regulators have treated ignoring it as relevant evidence in some disputes. See is web scraping legal and take legal advice for your own case.

Does robots.txt stop a page from appearing in Google?

No. It stops crawling, not indexing. A blocked URL can still be indexed from links, so use a noindex meta tag or X-Robots-Tag header on a crawlable page instead.

How do I block AI crawlers with robots.txt?

Add a group for each crawler’s published user agent token, such as GPTBot or ClaudeBot, with Disallow: /. Check each provider’s documentation for current tokens, since names and scopes change.

What happens if robots.txt returns an error?

A 4xx response is usually treated as no restrictions. A 5xx response or an unreachable server is treated as a full disallow, so a broken robots.txt can stop compliant crawlers fetching anything.

Do all crawlers obey robots.txt?

No. Search engines and most reputable bots do, but compliance is voluntary. Sites use rate limiting and anti-bot detection to deal with clients that ignore it.

Does Exabase crawl my website?

No. Exabase fetches the specific URLs that its users submit to Extract, bookmarks or link previews, rather than crawling sites independently.

Related pages: Web crawler, User agent, Sitemap XML, Anti-bot detection, Is web scraping legal, llms.txt, Web scraping, Web scraper tool, Best web scraping APIs

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.