What is robots.txt?
Robots.txt is the first file many crawlers request when they visit a site. It follows the Robots Exclusion Protocol: a set of rules grouped by user agent, the name a crawler uses to identify itself, with Allow and Disallow lines listing paths. It can also point crawlers to your XML sitemap.
It matters because it's a single file with site-wide reach. A good one keeps crawlers out of admin areas and endless filter URLs. A bad one can hide your whole site. Google's introduction to robots.txt covers the syntax, and the related terms sit in our SEO and AEO glossary.
What does a robots.txt example look like?
A robots.txt file is a few short groups of lines. The example below is a sensible default for a B2B marketing site that wants to appear in search and AI answers but keep its app and internal pages out.
Example robots.txt with AI crawler lines (adapt the paths to your site)
User-agent: * Disallow: /app/ Disallow: /search
User-agent: OAI-SearchBot Allow: /
User-agent: PerplexityBot Allow: /
User-agent: GPTBot Disallow: /
Sitemap: https://www.example.com/sitemap.xml
The first group applies to every crawler and keeps them out of the product app and internal search. The next two groups explicitly allow the crawlers behind ChatGPT search and Perplexity answers. The GPTBot group blocks OpenAI's training crawler, a choice some companies make and others don't. The last line points every crawler to the sitemap.
Whether to block training crawlers is a business decision, not an SEO one. We set out both sides in should you block or allow AI crawlers.
Which AI crawlers can robots.txt control?
Robots.txt can control most major AI crawlers, because the companies behind them publish their user agent names and say they honor the file. The key detail is that training and search often use different bots.
User agent | Operator | Used for |
|---|---|---|
Googlebot | Search, including AI Overviews and AI Mode | |
Google-Extended | A control for Gemini model training, not Search | |
OAI-SearchBot | OpenAI | Showing sites in ChatGPT search |
GPTBot | OpenAI | Collecting data for model training |
ClaudeBot | Anthropic | Collecting data for model training |
PerplexityBot | Perplexity | Indexing pages for Perplexity answers |
Blocking Google-Extended doesn't remove you from AI Overviews, because those run on Googlebot's crawl. Check each operator's documentation for current names, since they change.
What are the most common robots.txt mistakes?
The most common robots.txt mistakes are blocking the whole site by accident and using Disallow to hide pages that should be noindexed.
- Blocking pages you want deindexed. If Google can't crawl a page, it can't see a noindex tag on it. Allow crawling and add noindex instead.
- Blocking CSS and JavaScript. Google needs them to render pages. Blocking them can make pages look broken to the crawler.
- Treating it as security. The file is public and only polite bots follow it. Protect private areas with authentication.
- Expecting llms.txt to replace it. A separate llms.txt file is optional, and Ahrefs found 97% of llms.txt files got zero requests. See whether llms.txt is worth it.
Setup steps for both files are in XML sitemaps and robots.txt for startups, and a robots.txt review is a standard line item in any SEO audit report.
