What Is robots.txt?
robots.txt is a plain-text file placed at the root of a website (e.g. https://example.com/robots.txt) that tells well-behaved crawlers which parts of the site they should and shouldn't visit. It follows the Robots Exclusion Protocol, first proposed in 1994 and standardised in RFC 9309 in 2022.
It is not a security mechanism. It is a request. Malicious crawlers ignore it, and so do some scrapers. For actual access control, use authentication, IP allowlists, or HTTP 401 responses.
Basic Structure
User-agent: * Disallow: /admin/ Disallow: /private/ Allow: /admin/public/ Sitemap: https://example.com/sitemap.xml
Each rule has a User-agent line followed by one or more Allow / Disallow lines. Rules for a bot apply until the next User-agent line.
Allow vs Disallow
Disallow: /path/blocks all URLs starting with/path/.Disallow: /blocks the entire site.Disallow:(empty) — an empty value means "allow everything". Useful after a specific Disallow to reset access.Allow: /path/explicitly permits a path. When multiple rules match, the longest match wins.
Wildcards: * and $
Google and Bing support two wildcard characters:
*— matches any sequence of characters$— marks the end of the URL
Examples:
Disallow: /*.pdf$ # block all PDFs Disallow: /*?session= # block URLs with a session parameter Disallow: /search # block /search and everything under it Disallow: /search$ # block only /search, not /search/foo
What robots.txt Can and Cannot Do
| Can | Cannot |
|---|---|
| Ask well-behaved crawlers not to visit paths | Enforce access control |
| Point crawlers to your sitemap | Remove pages from search results |
| Set crawl delay for some bots | Control indexing of a page directly (use noindex) |
| Block entire sections you don't want indexed | Stop scrapers, competitors, or AI trainers who ignore it |
| Block malicious or unknown crawlers by name | Protect sensitive data |
Common Mistakes
- Using
Disallowto remove a page from Google. Google needs to crawl a page to see itsnoindextag. If you block it with robots.txt, the page may stay indexed without content. Usenoindexinstead, then optionally block after Google removes it. - Blocking CSS and JS. Google needs to render pages. Blocking
/assets/,/static/,/_next/or your CDN breaks the mobile-friendly test and rich results. - Forgetting case sensitivity.
/Admin/and/admin/are different paths. - Blocking the sitemap itself. Never disallow your sitemap URL.
- Using robots.txt for security. Sensitive paths need server-side protection, not a request to crawlers.
- Ignoring subdomains. Each subdomain needs its own robots.txt.
- Blocking the wrong AI crawler. There are dozens of AI crawlers with distinct user-agents. Blocking
GPTBotalone won't stop Google-Extended, ClaudeBot, PerplexityBot, CCBot, etc.
AI Crawlers in 2026
Many website owners now want to control whether their content trains or feeds AI models. Relevant user-agents:
GPTBot— OpenAI's training crawlerChatGPT-User— User-triggered browsing by ChatGPTOAI-SearchBot— OpenAI search indexClaudeBot— AnthropicGoogle-Extended— Google's AI training (does not affect Search)PerplexityBot— Perplexity AICCBot— Common Crawl, used by many LLMsBytespider— ByteDance (TikTok)Applebot-Extended— Apple IntelligenceMeta-ExternalAgent— Meta AI
To block all AI training while keeping search:
User-agent: GPTBot Disallow: / User-agent: ChatGPT-User Disallow: / User-agent: ClaudeBot Disallow: / User-agent: Google-Extended Disallow: / User-agent: PerplexityBot Disallow: / User-agent: CCBot Disallow: / User-agent: Bytespider Disallow: /
How to Use This Generator
- Builder tab: Set global rules, add per-bot rules, configure sitemaps. Watch the output update live.
- Presets tab: Start from a preset — WordPress, E-commerce, Block AI crawlers, Allow all, etc.
- Validate tab: Paste an existing robots.txt to check syntax and best practices.
- Copy or download the result and upload to your site's root directory.
- Verify it works: visit
https://yourdomain.com/robots.txtand use Google's robots.txt Tester (in Search Console).
Pro Tip: If you're unsure whether a rule blocks the right paths, use Google Search Console → robots.txt Tester (still available via URL Inspection → Test Live URL). It shows you exactly which URLs are allowed or blocked for Googlebot.
⚠️ AI-Generated Tool Notice: This robots.txt Generator was built with AI assistance. Crawler behavior evolves and some bots may ignore directives. Always test on a staging environment, verify with Search Console and Bing Webmaster Tools, and treat robots.txt as advisory, not as a security boundary.