Santaji GadeSEO, Technical SEO2 weeks ago36 Views

Robots.txt is a plain-text file that controls billions of dollars of traffic daily. Here's the complete syntax, real 2026 AI crawler blocking rules (GPTBot, ClaudeBot), wildcard patterns, and a rule tester to check your own directives.
Table of Contents
ToggleA single misplaced line in robots.txt can hide your entire site from Google. It is one of the smallest, oldest files on the web, plain text, four main directives, and it still controls billions of dollars of traffic every single day. This guide covers the full syntax, real AI crawler rules for 2026, and the one mistake that quietly de-indexes sites.
Robots.txt is a plain-text file placed at the root of a website that tells search engine crawlers and AI bots which URLs they are allowed or not allowed to access.
It follows the Robots Exclusion Protocol, formalized as RFC 9309, a standard respected by Google, Bing, and most major AI crawlers.
We covered the page-level counterpart to this file in our meta robots tags guide. Robots.txt blocks crawling before a page is ever fetched; meta robots tags control indexing after it already has been.
is Google's documented size limit for a robots.txt file; content beyond it is ignored
core directives cover nearly everything: User-agent, Disallow, Allow, Sitemap
the year the Robots Exclusion Protocol became an official standard, RFC 9309
User-agent: * Disallow: /admin/ Disallow: /cart/ Allow: /admin/public/ Sitemap: https://www.example.com/sitemap.xml
Must live at exactly yoursite.com/robots.txt; a file at /blog/robots.txt is simply ignored
Disallow is not noindex. Blocking a URL in robots.txt only stops crawling. If other sites link to that URL, it can still appear in search results, just without a title or description, since Google never fetched the page to read a noindex tag.
| Directive | What It Does |
|---|---|
User-agent | Specifies which crawler the following rules apply to |
Disallow | Blocks crawling of a specific path; empty value means allow everything |
Allow | Creates an exception inside a broader Disallow rule |
Sitemap | Points crawlers to your sitemap location; can appear anywhere, applies globally |
According to Ixieverse's complete robots.txt setup guide, combining the asterisk and dollar sign builds precise patterns matching specific URL structures rather than entire directories.
# Block every PDF file across the entire site Disallow: /*.pdf$ # Block any URL containing a query string starting with ?sort= Disallow: /*?sort= # Block an entire path and everything beneath it Disallow: /search
The dollar sign anchors the match to the end of the URL; without it, the pattern matches anywhere
According to ToolsDock's complete 2026 robots.txt guide, every major AI company now runs its own crawler, some for training data, some for real-time browsing, and some for both.
# Allow Google and Bing as normal User-agent: Googlebot Allow: / # Block OpenAI's training crawler specifically User-agent: GPTBot Disallow: / # Allow Anthropic's on-demand fetch bot, block its training crawler User-agent: Claude-User Allow: / User-agent: ClaudeBot Disallow: /
Different bots from the same company often serve different purposes; block selectively, not all at once
This depends entirely on your goals. Tap through both perspectives.
Concerns about content being used for AI training without compensation, or protecting a paywalled business model, are valid reasons some publishers block AI training crawlers specifically.
Blocking search-oriented AI crawlers reduces visibility in ChatGPT, Perplexity, and AI Overviews, channels increasingly driving real referral traffic for many sites.
Enter a Disallow pattern and a URL path to see if the rule would block it.
Supports basic wildcard (*) and end-anchor ($) matching
According to Conductor's guide to robots.txt essential rules, one incorrect rule can block major sections of a site from search engines and AI bots simultaneously, making careful review essential before any change goes live.
Directives only apply to the exact domain and protocol where the file is hosted, meaning http and https versions of the same site need matching files if both are technically reachable.
According to InstarankSEO's complete 2026 robots.txt guide, a crawler looks for its specific User-agent block first, and falls back to the wildcard block only if no matching specific entry exists.
Multiple user-agents can also share the exact same set of rules, listed as consecutive User-agent lines followed by one shared block of directives, avoiding the need to repeat identical rules for each bot separately.
| Mistake | What Happens |
|---|---|
Disallow: / left in from staging | Blocks the entire live site from every crawler |
| Blocking CSS or JS directories | Google can't render the page properly to evaluate it |
| Using robots.txt to hide indexed pages | Doesn't remove them; use noindex on the page instead |
| File placed anywhere but the root | Ignored entirely; must be at yoursite.com/robots.txt exactly |
| Relying on Crawl-delay for Googlebot | Google ignores this directive completely |
According to SE Ranking's robots.txt syntax and setup guide, a bot can technically choose not to obey the file at all, though major search engines and reputable AI crawlers do respect it in practice.
According to DominateTools' complete 2026 reference guide, testing changes in Google Search Console's report before deploying catches accidental blocks before they affect live crawling.
According to Fieldari's guide to examples, rules, and mistakes, the gap between what this file does and what it doesn't do is exactly where even experienced developers trip up, making a test pass before publishing a genuinely worthwhile habit.
According to ValidateHTML's complete syntax reference, running the final file through a dedicated syntax checker catches typos and malformed directives a quick manual read-through can easily miss.
Robots.txt controls crawling; it never guarantees a page stays out of the index
Four directives cover almost everything: User-agent, Disallow, Allow, Sitemap
The file must live at the exact domain root, nowhere else
Wildcard and end-anchor patterns allow precise, targeted rules
Different AI crawlers can be allowed or blocked selectively per bot
Always test changes before deploying; one bad line can block an entire site










