A single misplaced character in your robots.txt file can de-index an entire commercial website overnight. Despite being one of the simplest plain-text files on your web server—typically weighing less than 1 kilobyte—it acts as the primary traffic controller for search engine spiders, web scrapers, and artificial intelligence training bots.
Yet many webmasters and developers fundamentally misunderstand how web crawlers interpret its directives. Common myths—such as believing Disallow removes pages from Google search results, or assuming Google obeys Crawl-delay—continue to sabotage search visibility.
Here is the authoritative guide to writing a clean, high-performance robots.txt file for modern SEO, managing AI scrapers, and avoiding catastrophic indexing errors.
What Robots.txt Does (and What It Never Does)
The Robots Exclusion Protocol (standardized under RFC 9309) governs how automated user-agents crawl web servers:
- What Robots.txt Does: It tells automated crawlers which URLs they are permitted to request and download from your server. It preserves crawl budget, prevents server overload from repetitive dynamic searches, and blocks internal staging environments.
- What Robots.txt Does NOT Do: It does NOT prevent a URL from being indexed by search engines. If external websites or internal pages link to a disallowed URL, Google will still index the link. It will appear in search results with the infamous message: “No information is available for this page. Learn why.”
+------------------------------------------------------------------------+
| URL BLOCKED IN ROBOTS.TXT: |
| Crawler blocked from downloading page -> Cannot read meta tags |
| Result: URL STILL INDEXED in Google search as an empty title snippet! |
+------------------------------------------------------------------------+
| URL WITH <meta name="robots" content="noindex">: |
| Crawler allowed to fetch page -> Reads "noindex" -> REMOVES FROM INDEX |
+------------------------------------------------------------------------+
The Golden Rule: If you want a page completely excluded from Google search, you must ALLOW Googlebot to crawl it in
robots.txtand place<meta name="robots" content="noindex">directly inside the HTML page<head>.
Anatomy and Syntax of a Robots.txt File
A valid robots.txt file must be located in the top-level root directory of your website host (https://example.com/robots.txt). Files placed in subfolders (such as /blog/robots.txt) are ignored by search crawlers.
Modern Production Robots.txt Template:
# Block bad scrapers and restrict private endpoints
User-agent: *
Disallow: /admin/
Disallow: /api/
Disallow: /cart/
Disallow: /checkout/
Disallow: /search
Allow: /api/public/
# Explicitly declare XML sitemaps for fast discovery
Sitemap: https://example.com/sitemap-index.xml
Directive Breakdown:
User-agent: Names the specific crawler the block applies to (*applies to all crawlers;Googlebottargets Google;Bingbottargets Bing).Disallow: The path prefix crawlers must not request. An emptyDisallow:line explicitly allows crawling everything.Allow: Overrides a broaderDisallowrule for a specific nested subpath or asset.Sitemap: Direct absolute URL to your XML sitemap index. You can include multipleSitemap:lines.
Managing AI Scrapers and LLM Crawlers in 2026
With the rise of large language models (LLMs) and AI search agents, many publishers choose to differentiate between traditional search engines (which send organic referral traffic) and AI training crawlers (which scrape content to train models without referral clicks).
If you want search engines to index your content while preventing AI bots from scraping your proprietary articles, declare explicit user-agent blocks:
# Allow major search engines full access
User-agent: Googlebot
User-agent: Bingbot
User-agent: DuckDuckBot
Allow: /
# Block AI training bots and commercial scrapers
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: PerplexityBot
User-agent: CCBot
User-agent: anthropic-ai
User-agent: Bytespider
Disallow: /
| AI Bot Name | Organization | Primary Purpose |
|---|---|---|
GPTBot |
OpenAI | Web scraping for ChatGPT training models |
ClaudeBot |
Anthropic | Web scraping for Claude training models |
PerplexityBot |
Perplexity AI | Real-time indexing for AI search answers |
CCBot |
Common Crawl | Open repository used by multiple foundation models |
Bytespider |
ByteDance / TikTok | Aggressive high-volume web content scraping |
The 4 Most Dangerous Robots.txt Disasters
1. The Accidental Staging Leak (Disallow: /)
During website redesigns, developers commonly block staging servers with:
User-agent: *
Disallow: /
If this file is accidentally copied to production during deployment, Googlebot will halt all crawling within 24 to 48 hours. Organic rankings and search traffic will plummet.
2. Blocking CSS, JavaScript, and Font Files
In older SEO eras, webmasters routinely blocked /assets/, /css/, and /js/ folders to save crawl budget. Today, Googlebot renders web pages like a modern headless Chromium browser. If you block your CSS or JavaScript, Google cannot verify mobile responsiveness, text legibility, or layout stability, triggering severe mobile SEO penalties.
3. Relying on Crawl-delay for Google
Many site owners add Crawl-delay: 10 expecting Googlebot to pace its requests. Google has never supported the Crawl-delay directive. Bing and Yandex support it, but Googlebot completely ignores it. To adjust Googlebot crawling speed, configure crawl rate settings directly inside Google Search Console.
4. Case-Sensitivity Mismatches
Robots.txt paths are strictly case-sensitive. Writing Disallow: /private/ will not block requests to /Private/ or /PRIVATE/. Ensure all URLs and disallowed rules match exact URL casing standards.
Pattern Matching with Wildcards (* and $)
Modern search engines support wildcard pattern matching:
*(Any character sequence): Matches zero or more arbitrary characters.$(End of URL anchor): Matches the exact end of a URL path.
# Block all URLs with dynamic search query parameters
Disallow: /*?*
# Block crawling of raw PDF documents
Disallow: /*.pdf$
# Block specific file extensions while allowing HTML
Disallow: /*.json$
Disallow: /*.xml$
Allow: /sitemap.xml
How to Test and Audit Your Robots.txt File
Before publishing modifications to your live web server:
- Generate Clean Production Rules: Use our free Robots.txt Generator on DwellixTools to create syntactically validated rules for Google, Bing, and modern AI scrapers in seconds.
- Audit Live HTTP Headers and Accessibility: Verify that your live
/robots.txtreturns an HTTP 200 status code and is not blocked behind a redirect loop using our browser-based Website Checker.
Frequently Asked Questions
Can anyone see my robots.txt file?
Yes. Your robots.txt file is completely public to anyone who navigates to https://yourdomain.com/robots.txt. Never list sensitive internal folder names, private database endpoints, or secret admin login URLs in robots.txt—malicious attackers routinely scan this file to discover unlisted administrative directories.
What is the maximum file size for robots.txt?
Google supports robots.txt files up to 500 kilobytes (KB). Any content beyond 500 KB is truncated and ignored. A standard, well-maintained file should rarely exceed 5 to 10 KB.
What happens if my robots.txt server returns an HTTP 500 error?
If your server experiences an outage and returns an HTTP 500 (Internal Server Error) when Googlebot requests /robots.txt, Google temporarily pauses all crawling of your website to prevent indexing unverified pages. If the 500 error persists for more than a few days, Google begins dropping pages from search results.
Related Tools
Free browser tools related to this guide. Process locally with zero sign-up.
Robots.txt Generator & Validator
Generate, customize, and validate RFC 9309-compliant robots.txt files. Manage search bots, block AI scrapers, configure sitemaps, and test URL access in real-time.
Website Health Checkup & Responsive Previewer
Audit any website for SEO health, mobile readiness, security headers, and TTFB latency. Preview responsive layouts live on mobile, tablet, and desktop screens.