Key Takeaways
Robots.txt is a simple text file placed at /robots.txt in the root of your host that tells crawlers which URLs they can access. It does not keep pages out of Google and is not a security measure (Google Search Central).
Rules apply only to the host, protocol, and port where the file is hosted, so each subdomain needs its own file. Google ignores content after 500 KiB (Google Search Central).
Keep sensitive content behind authentication, and use noindex (via a meta robots tag or the X-Robots-Tag HTTP header) to keep pages out of search results, which requires the page to be crawlable (Google Search Central).
You can guide good bots, block known AI bots, and focus crawling on important pages, but only if those bots respect the Robots Exclusion Protocol. Google does not support the crawl-delay field.
This article is written from Nonofo Joel’s SEO and AEO (AI-Engine Optimization) perspective, with concrete examples, code snippets, and step-by-step instructions on how to create a robots.txt file correctly.
Introduction to Robots.txt and the Robots Exclusion Protocol
Robots.txt is one of the oldest and most misunderstood files on the web. RFC 9309 formalizes the Robots Exclusion Protocol that Martijn Koster defined in 1994 (IETF RFC 9309, 2022), so the method was informal for nearly three decades. Today this humble text file remains a core technical SEO control and a way to state your preferences to AI crawlers.
The protocol operates as a voluntary agreement: major search engines like Google and Bing honor it, and several AI companies state that their crawlers do too (see the AI bots section below). But compliance depends entirely on the crawler. RFC 9309 states that these rules are not a form of access authorization (IETF RFC 9309), so a robots.txt file helps manage crawling but cannot force anything.
To see what a live robots.txt file looks like, visit any major website’s root URL and append /robots.txt. You will find directives that tell crawlers which paths are open and which are off-limits. These files range from a few lines to hundreds of rules.
From my consulting perspective, robots.txt is a foundational technical SEO tool. It supports brand visibility by ensuring crawlers find and index the right pages, while keeping low-value or private areas away from search engine results. When combined with a clear content strategy, it becomes a key piece of your AI-era visibility stack.
What Is a Robots.txt File Used For?
A robots.txt file is a plain text configuration file placed at the root of an entire website or subdomain. It tells web crawlers which paths they may crawl and which they should skip. For instance, https://shop.example.com/robots.txt controls crawler access specifically for that subdomain.
Its primary role is controlling crawler behavior for good bots like Googlebot and Bingbot and for AI bots such as GPTBot and ClaudeBot. It also discourages bad bots and aggressive scrapers, though malicious bots may ignore the protocol entirely. Robots.txt files instruct crawlers on website access, but the instruction is a request rather than a wall.
Google says robots.txt is used mainly to avoid overloading your site with requests (Google Search Central). Large websites often use it to manage crawling by blocking low-value pages like faceted navigation URLs, duplicate search results, or tag archives. This is especially valuable when you understand the difference between crawling and indexing.
A critical distinction: robots.txt governs crawling, not indexing. Google says it might still find and index a disallowed URL if it is linked from other places on the web (Google Search Central).
Consider two hypothetical scenarios. A very large ecommerce site with product filters generates thousands of parameterized URLs like ?color=blue&size=large. Blocking these in robots.txt keeps crawling focused on real product and category web pages. A small brochure site, by contrast, barely needs any rules beyond allowing everything and listing a sitemap.
Limitations and Misconceptions of Robots.txt
The robots.txt file does not act as a security measure and is publicly accessible. Anyone can visit your robots.txt file directly and see every path you have listed. Sensitive content like admin panels, customer data, or staging environments should be protected with authentication, IP restrictions, or VPN access.
The Robots Exclusion Protocol is voluntary. Googlebot typically honors robots.txt directives, and other reputable search engine bots do too. But malicious bots and poorly written crawlers can completely ignore your txt instructions. Robots.txt is a signal, not a firewall.
Blocking URLs in robots.txt does not guarantee they will not appear in search results. Google says it might still index a disallowed URL if it is linked from other places on the web (Google Search Central). This is a common source of confusion for site owners.
The meta robots tag and the X-Robots-Tag HTTP header are the tools for controlling indexing. Google says a page with a noindex rule must not be blocked by robots.txt and must be otherwise accessible to the crawler, and that the X-Robots-Tag can be used for non-HTML resources such as PDFs (Google Search Central). This creates a paradox: you must allow crawling of any page where you want a noindex directive to be seen and respected.
For truly private areas, use server-side authentication rather than simply adding a disallow directive.
Core Syntax: User-Agents, Directives, and Maximum Size Constraints
The basic structure of a robots.txt file consists of groups of rules. Each group starts with a user agent line followed by one or more directives. The Robots Exclusion Protocol defines how crawlers should interpret the robots.txt file based on these groups.
Directives in the robots.txt file include user-agent, disallow, and allow. The user-agent field specifies which bots the rules apply to. You can target specific bot user agents like Googlebot, Googlebot-Image, Bingbot, ClaudeBot, GPTBot, or PerplexityBot. You can also use User-agent: * to address all web robots. Per Google’s specification, field names and user-agent values are case-insensitive, but path values are case-sensitive, so /Admin is not the same as /admin (Google Search Central).
Robots.txt files should be saved as UTF-8 encoded plain text, with one directive per line (Google Search Central). Google ignores content after 500 KiB, and RFC 9309 says crawlers should parse at least 500 kibibytes (IETF RFC 9309). In practice almost all files are far smaller: the 2024 Web Almanac found that 97.82% of robots.txt files in mobile crawls were under 100 KB and only 0.06% were over 500 KB (HTTP Archive Web Almanac 2024).
You can have multiple user agents in one file, each with their own rules. Here is the overall structure:
User-agent: *
Disallow: /private/
Allow: /private/public-page/
User-agent: GPTBot
Disallow: /
Sitemap: https://www.example.com/sitemap.xml
This example allows all crawlers to access the site except the /private/ directory (with one exception), blocks GPTBot from the entire site, and points all crawlers to the sitemap.
Key Directives in Robots.txt (Allow, Disallow, Crawl-delay, Sitemap)
Each directive in a robots.txt file shapes crawler behavior in a specific way. Here is how the main four work.
Disallow is the primary directive. The disallow command prevents bots from accessing specific pages or directories. Robots.txt files can block specific directories from crawling. For example, Disallow: /private-reports/ tells a bot not to crawl anything under that path. A Googlebot Disallow rule applies only when the user-agent group targets Googlebot specifically.
Allow permits crawling of a specific sub-directory within a disallowed area. The allow command permits access to specific pages or directories that would otherwise be blocked. For example, if you disallow /media/ but want press assets available, you add Allow: /media/brand-kit/.
Crawl-delay specifies how long bots should wait between requests, and support varies by crawler. Google says the crawl-delay field is not supported (Google Search Central). Bing treats it as a relative throttle and advises using the lowest value that works and avoiding values above 10 (Bing Webmaster blog), and Anthropic says it supports Crawl-delay (Anthropic).
Sitemap is a discovery hint. Google says the sitemap line must be a fully qualified URL including the protocol and host, and is not tied to any user agent (Google Search Central). For example: Sitemap: https://www.example.com/sitemap.xml. Include the directive in every production robots.txt file.
How to Create a Robots.txt File (Step-by-Step)
To create a robots.txt file, start with any plain text editor. Create a new file and save it as robots.txt with UTF-8 encoding. Do not use a word processor that adds formatting.
Write your basic rules starting with User-agent: * to address all crawlers. Then add disallow lines for any paths you want blocked. It is common to block administrative and internal areas in robots.txt, such as /admin/, /cart-test/, or /tmp/.
A robots.txt file is placed in the root directory of your web server, accessible at exactly https://yourdomain.com/robots.txt. Placing it in subfolders like /assets/robots.txt will not work. The file must be at the root for crawlers to find it.
Each domain and subdomain must have its own file, because rules apply only to the host, protocol, and port where the file is hosted (Google Search Central). If your brand runs www.example.com, blog.example.com, and api.example.com, each needs a separate robots.txt file with rules specific to that host.
Here is a simple starter example for a site that allows all good bots but blocks staging and admin areas:
User-agent: *
Allow: /
Disallow: /admin/
Disallow: /cart-test/
Disallow: /tmp/
Sitemap: https://www.example.com/sitemap.xml
This file keeps the entire website open to crawlers while preventing access to a few directories that have no business appearing in search results. Robots.txt files must be saved as plain text with UTF-8 encoding, and should be placed in the root directory.
Where to Put Robots.txt and How It Interacts with Meta Robots Tags
Robots.txt must reside at the root of the protocol and host combination it controls. https://example.com/robots.txt and https://sub.example.com/robots.txt are separate files, and so are the HTTP and HTTPS versions (Google Search Central). Each host needs its own file.
Robots.txt works at the path level, controlling which directories and pages crawlers can request. The meta robots tag (placed in the HTML head) and the X-Robots-Tag (sent via HTTP headers) operate at the individual URL level. They handle indexing control rather than crawl access.
Here is the key interaction: if a URL is disallowed in robots.txt, Google’s crawler will not fetch that page. If you placed a <meta name=”robots” content=”noindex, nofollow”> on that blocked page, Googlebot never sees it, and the noindex instruction goes unread (Google Search Central).
The recommended strategy is to allow crawling for any page you truly want noindexed. Let the crawler fetch the HTML so it can read the meta robots tag and act on it. This rule applies to any page where indexing control matters more than blocking access.
Other meta tags like canonical, hreflang, and Open Graph also need to remain crawlable. Accidentally blocking CSS, JS, or HTML templates that contain these tags can break how search engines understand your site.
Handling AI Bots, Good Bots, and Bad Bots in 2026
Good bots are search engine crawlers and reputable AI bots that follow the Robots Exclusion Protocol. Bad bots are those that ignore rules, scrape aggressively, or attempt to exploit security vulnerabilities. Robots.txt addresses good bots effectively but offers little defense against bad bots on its own.
Several AI companies publish their crawler names and say they honor robots.txt. OpenAI documents GPTBot (which may collect content for model training) and OAI-SearchBot (which supports appearing in ChatGPT search), and says each setting is independent (OpenAI). Anthropic says ClaudeBot follows robots.txt directives (Anthropic), and Perplexity documents PerplexityBot, which it says is not used to crawl for foundation models (Perplexity docs). Site owners can block or allow each independently. For context, the 2024 Web Almanac found GPTBot rules in 2.9% of desktop and 2.6% of mobile robots.txt files crawled (HTTP Archive Web Almanac 2024).
Robots.txt does not legally prevent AI models from training on your content, but it is a clear, documented signal of your preferences.
Here is a configuration that allows traditional search engines but blocks known AI bots:
User-agent: *
Allow: /
User-agent: GPTBot
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: PerplexityBot
Disallow: /
From an SEO vs AEO perspective, selectively allowing certain AI bots can help your brand surface in AI-powered answers while limiting unsanctioned scraping. This is a strategic decision, not just a technical one.
Performance, Crawl Budget, and Crawl-Delay for Larger Sites
Crawl management matters most for larger sites. When search engine bots spend time on low-value web pages like endless filter combinations, tag pages, or internal search results, they have less capacity for your important pages. Keep in mind that robots.txt keeps crawlers focused, but it does not remove pages from the index.
Use disallow rules on internal search URLs (e.g., Disallow: /*?q=), faceted paths (e.g., Disallow: /category/*/size-*/color-*/), or duplicate printer-friendly versions. This preserves crawl resources for product pages, blog posts, and other pages that drive organic traffic.
Robots.txt can help control server load by limiting bot activity, and crawl-delay can slow crawlers that honor it. Bing advises using the lowest value that works and avoiding values above 10, and Google does not support the field at all (Bing Webmaster blog; Google Search Central). For critical performance issues, rate limiting at the server or WAF level may be more effective than robots.txt alone.
Monitor server logs to see how often bots hit your server before adjusting rules. Look at requests per minute by user agent, and adjust your txt directives only after you detect actual load issues or wasted crawling.
Common Mistakes When Configuring Robots.txt
Here are the most frequent common mistakes that silently damage site visibility:
Blocking the entire site during development. Adding Disallow: / for all user agents on a staging server, then pushing it to production. This hides your entire website from all crawlers.
Blocking CSS and JS assets. Disallowing /wp-content/ on WordPress sites can prevent search engines from rendering pages properly, which can affect how Google understands your content.
Incorrect case sensitivity. Since path values are case sensitive, Disallow: /Admin does not match /admin. These errors cause silent failures that are hard to detect without testing.
Placing robots.txt in the wrong location. Putting it inside /public/ or another subfolder instead of the root directory means no crawler will find it.
Overly broad wildcards. A rule like Disallow: /*? can unintentionally block valuable campaign URLs or faceted pages you actually need crawled.
Exceeding the maximum size. Google ignores content after 500 KiB (Google Search Central). If your AI bot rules are near the end of a very large file, they may be skipped.
Always test changes before deploying. Version-control your robots.txt alongside your website code. For a broader view of technical pitfalls, review this guide on common SEO mistakes that hurt visibility.
Testing, Monitoring, and Iterating Your Robots.txt Strategy
Test your robots.txt changes before and after deploying. Google Search Console has a robots.txt report, and its recrawl request can speed up how quickly Google refreshes its cached copy of the file (Google Search Central). Pair it with a URL-testing feature in your preferred SEO crawler to confirm whether a given page is blocked or allowed for a given user agent.
Use server logs to validate that disallow and crawl-delay rules actually influence crawler behavior. Look for log entries labeled with specific bot names like Googlebot, Bingbot, or GPTBot. If disallowed pages still show heavy crawl traffic from other bots, your rules may not be working as intended.
Combine robots.txt checks with meta robots tag and X-Robots-Tag audits using your preferred SEO crawling tool. Make sure disallowed pages are not also tagged with noindex, since the crawler will never see that tag. A thorough technical SEO checklist helps catch these conflicts.
Webmasters should regularly review and update their robots.txt files to reflect website changes. Treat this as an ongoing process: review at least quarterly or any time you launch a new section, replatform, or change URL structures.
Robots.txt for Brand Strategy, SEO, and AEO (Nonofo Joel’s Perspective)
Robots.txt decisions connect directly to brand strategy. What you block or allow shapes which stories, categories, and product lines search engines and AI bots associate with your brand. Blocking your best content hubs from crawlers is like closing the front door to visitors.
Topic clusters and content hubs should remain fully crawlable. Thin tag pages, internal search results, and temporary campaign URLs are candidates for disallowing. When you build topic clusters for SEO and AI visibility, make sure robots.txt does not accidentally cut off supporting pages from crawlers.
AEO, or AI-Engine Optimization, depends on well-structured crawl paths. When AI systems like ChatGPT or Google’s AI Overviews can access and understand your content, they have more accurate material to work from. Robots.txt, sitemaps, and clean site architecture all contribute to how technical SEO affects AI search.
I recommend a simple internal process for marketing teams: collaborate with developers once per quarter to review robots.txt, XML sitemaps, and robots meta tags as one coherent visibility system.
If you want to align your robots.txt, SEO, and AI-era brand positioning, subscribe to my newsletter or reach out for a consulting session. Getting these foundational files right is a cheap, high-value step for long-term visibility.
FAQs About Robots.txt
Is robots.txt still relevant in 2026 now that AI search is growing?
Robots.txt remains a core part of technical SEO, and OpenAI, Anthropic, and Perplexity each document how their crawlers respond to it. While it does not guarantee compliance from every bot, it is one of the clearest machine-readable signals you can send about the crawler behavior you want for your site. I recommend treating robots.txt as a minimum baseline control layer for both search engines and AI bots.
Can I use one robots.txt file to control multiple domains?
Each protocol and host combination requires its own robots.txt file at its own root (Google Search Central). A single file at https://example.com/robots.txt cannot control https://shop.example.com or https://blog.example.com. If your brand has a main site, a blog subdomain, and a docs subdomain, each needs its own robots.txt file. Manage them in the same code repository to keep them consistent.
What happens if my robots.txt file is missing or returns a 404?
Google treats most 4xx responses for robots.txt (except 429) as if no robots.txt file exists, so it assumes there are no crawl restrictions. A persistent 5xx error is more serious: Google stops crawling for the first 12 hours while retrying, then uses the last good cached version for up to 30 days (Google Search Central). Always ensure robots.txt returns a 200 status for live sites, even if the file content is intentionally minimal.
Can I fully block AI training on my content with robots.txt alone?
Robots.txt alone cannot fully prevent your content from being used for AI training, especially by actors that ignore the standard. OpenAI and Anthropic state that GPTBot and ClaudeBot follow robots.txt rules (OpenAI; Anthropic), so blocking those bots signals that your content should not be used for training. For stronger protection, combine robots.txt rules with legal measures, licensing terms, or rate limiting.
How big can my robots.txt file be before it causes problems?
Google ignores content after 500 KiB of a robots.txt file (Google Search Central), and RFC 9309 says crawlers should parse at least 500 kibibytes. Consolidate redundant rules using wildcards and $ anchors, and periodically clean out obsolete directives that reference removed directories or legacy CMS paths. Any site approaching this threshold should treat robots.txt as an actively managed configuration asset, not an afterthought.
Sources
- Introduction to robots.txt (Google Search Central)
- How Google interprets the robots.txt specification (Google Search Central)
- Block Search indexing with noindex (Google Search Central)
- Ask Google to recrawl your robots.txt file (Google Search Central)
- RFC 9309: Robots Exclusion Protocol (IETF)
- Web Almanac 2024: SEO (HTTP Archive)
- Overview of OpenAI Crawlers (OpenAI)
- Perplexity Crawlers (Perplexity)
- Does Anthropic crawl data from the web, and how can site owners block the crawler? (Anthropic)
- Crawl delay and the Bing crawler, MSNBot (Bing Webmaster blog)