Robots.txt
Robots.txt is a plain text file at the root of a website that tells search engine and other crawlers which URLs they may or may not request.
Also called: robots.txt file, robots exclusion protocol, robots exclusion standard
Robots.txt is a plain text file at the root of a website that tells crawlers which URLs they may request. Search engines, SEO tools and AI bots check it before crawling. It is the bluntest instrument in technical SEO: one wrong line can hide a whole site from search, and a missing line can let bots waste time on endless filtered URLs.
How it works
The file lives at yourdomain.com/robots.txt and is made of groups. Each group names a crawler with User-agent and lists rules beneath it:
User-agent: *
Disallow: /app/
Disallow: /*?sort=
Allow: /app/signup
User-agent: GPTBot
Disallow: /customers/private/
Sitemap: https://example.com/sitemap.xml
How crawlers read it:
- A crawler finds the group that matches its name most specifically, or falls back to the * group.
- Within that group, the most specific matching rule wins, so a longer Allow can override a shorter Disallow.
- Wildcards (*) and end anchors ($) let you match URL patterns.
- The Sitemap line points crawlers to your XML sitemap.
Google ignores the crawl-delay directive and only processes the first 500 KiB of the file. Compliance is voluntary: reputable crawlers follow robots.txt, bad actors do not, so it is not a security tool.
The most important distinction: robots.txt controls crawling, not indexing. If you block a page that has a noindex tag, Google never sees the tag and the URL can stay indexed.
Example
Say an ecommerce site has 3,000 product and category pages but crawlers find 90,000 URLs because every filter combination creates a new address (assumptions throughout). Logs show Googlebot spends most of its requests on filtered URLs, and new products take weeks to get indexed.
Adding Disallow rules for the filter parameters, while keeping the main category pages open, cuts crawlable URLs back toward 3,000. Crawling shifts to pages that matter, which protects crawl budget. If new products get indexed in days instead of weeks and each launch earns $2,000 in its first month from organic, getting 20 launches a quarter indexed two weeks sooner is worth real money.
Robots.txt and AI crawlers
AI companies publish crawler names, such as GPTBot from OpenAI, ClaudeBot from Anthropic, PerplexityBot and Google-Extended, a token that controls whether Google can use your content for its Gemini models without affecting Google Search. You can allow or block each separately.
Our default for B2B marketing sites: allow the major AI crawlers on public pages, because being read is a precondition for being cited, and block them only where content is private, licensed or the core product. Pair that with clear content and an llms.txt file if you want to guide what models read first. Track the impact on AI visibility rather than guessing.
Common mistakes
- Shipping a staging "Disallow: /" to production during a launch.
- Blocking pages you want deindexed, which hides the noindex tag from Google.
- Blocking CSS and JavaScript files that crawlers need to render pages.
- Assuming robots.txt keeps private files private, when the file itself lists the paths publicly.
- Blocking every AI crawler by default without deciding whether AI citations matter to you.
FAQ
Does robots.txt stop a page from appearing in Google?
No. It stops crawling, not indexing. Google can still index a blocked URL if other pages link to it, usually showing it without a description. To keep a page out of search results, allow crawling and use a noindex tag, or protect it with a login.
Should I block AI crawlers in robots.txt?
It depends on your goals. Blocking crawlers like GPTBot or ClaudeBot can keep your content out of some AI training and answer systems, but it can also reduce how often you are cited in AI answers. Many B2B companies allow them on public marketing content and block them on private or premium areas.
Where does the robots.txt file go?
At the root of each host, such as example.com/robots.txt. Each subdomain and protocol needs its own file, so blog.example.com has a separate robots.txt. A file in a subfolder is ignored.
Related
Used in these articles
- ArticleAgentic Commerce: What's Real, What Decides Whether an Agent Picks You, and When to Move
- ArticleAI Crawlers Explained: Who Each Bot Is, What It Takes and What to Allow
- ArticleBing Webmaster Tools: The Setup That Gets You Into AI Answers
- ArticleChatGPT Search Optimization: How to Get Found, Cited and Clicked
- ArticleGemini Optimization: How to Get Your Pages Cited in Google's Gemini App
- ArticleJavaScript SEO: How Google and AI Crawlers See Your Site