Why You Are Here
A robots.txt file is four or five lines of plain text, and getting it wrong can remove your entire site from search results. One misplaced slash is the difference between blocking an admin folder and blocking everything you have ever published.
That asymmetry is the whole reason to use a generator. The syntax is not complicated, but it is unforgiving, and there is no error message when you get it wrong. The file simply does something other than what you intended, quietly, until someone notices the traffic has gone.
The first situation is setting up a new site. You need a working robots.txt, you want the sitemap directive in the right format, and you would rather not learn the Robots Exclusion Protocol from scratch to write five lines.
The second is stopping crawl waste. Your site generates URLs nobody should be crawling: filtered product listings, internal search results, session parameters, staging paths. Every request a crawler spends there is one it does not spend on pages that matter.
The third is increasingly common: controlling AI crawlers. Language model training crawlers and AI search agents now visit most sites, and robots.txt is currently the main mechanism site owners have for saying yes or no to them.
What This Tool Does
The Robots.txt Generator gives you form controls for each directive and builds correctly formatted output as you work.
Set your default rule, add paths you want to allow or disallow, choose which crawlers each rule applies to, add your sitemap URL, and optionally block AI training crawlers. The generated file appears ready to copy or download.
The Most Important Thing to Understand
robots.txt controls crawling. It does not control indexing.
These are different things, and confusing them causes real damage. Disallow tells a crawler not to FETCH a page. It does not tell a search engine not to LIST it. If other sites link to a URL you have disallowed, Google can still index that URL and show it in results, typically as a bare link with no description and a note that no information is available.
The trap is worse than it first appears. If you want a page removed from search results, the correct tool is a noindex meta tag or X-Robots-Tag header. But a crawler has to FETCH the page to see that tag. If you have disallowed the page in robots.txt, the crawler never fetches it, never sees the noindex, and the page stays indexed indefinitely.
The correct sequence for removing a page from search
- Allow crawling of the page in robots.txt
- Add noindex to the page
- Wait for the search engine to recrawl and drop it
- Only then disallow it in robots.txt, if you still want to save crawl budget
robots.txt Directive Reference
|
Directive |
Purpose |
Google Support |
|
User-agent |
Names which crawler the following rules apply to |
Yes |
|
Disallow |
Blocks crawling of a path |
Yes |
|
Allow |
Permits a path inside a disallowed directory |
Yes |
|
Sitemap |
Points to your XML sitemap, full URL required |
Yes |
|
Crawl-delay |
Requests a pause between requests |
NO — ignored |
|
Noindex |
Was never officially supported |
NO — removed 2019 |
|
Host |
Preferred domain |
No |
|
* wildcard |
Matches any sequence of characters |
Yes |
|
$ end anchor |
Matches the end of a URL |
Yes |
Google ignores Crawl-delay completely
It always has. Bing and Yandex honour it. If Googlebot is overloading your server, adjust the crawl rate in Search Console or return 503 responses. The directive will do nothing. A great deal of published advice still recommends it without this caveat.
Noindex in robots.txt stopped working on 1 September 2019
Google formally removed support for it. If you have inherited a file containing Noindex: lines, they are doing nothing, and the pages they reference may well be indexed.
How Rule Matching Works
When several rules could apply to one URL, Google uses the MOST SPECIFIC rule, measured by the length of the path. If two rules are the same length, the LEAST RESTRICTIVE one wins, meaning Allow beats Disallow.
User-agent: * Disallow: /blog/ Allow: /blog/public/ # /blog/public/post matches both rules. # The Allow path is longer, so it wins. # The page is crawlable.
Wildcards
Disallow: /*?sort= # any URL containing ?sort= Disallow: /*.pdf$ # any URL ending in .pdf Disallow: /private*/ # /private1/, /private-docs/, etc. # * matches any sequence of characters # $ anchors to the end of the URL # Both are Google extensions rather than part of the original # standard, though all major search engines now support them.
AI Crawler Reference
AI companies operate crawlers for training data, retrieval, and user-initiated browsing. Most publish a user-agent token you can target in robots.txt. Blocking is voluntary compliance rather than technical enforcement, but the major operators do honour it.
|
User-agent |
Operator |
Purpose |
|
GPTBot |
OpenAI |
Model training |
|
OAI-SearchBot |
OpenAI |
Search indexing |
|
ChatGPT-User |
OpenAI |
User-initiated fetches |
|
ClaudeBot |
Anthropic |
Model training |
|
Google-Extended |
|
Gemini training, separate from Search |
|
Applebot-Extended |
Apple |
Apple AI training |
|
PerplexityBot |
Perplexity |
Search indexing |
|
CCBot |
Common Crawl |
Open crawl dataset |
|
Bytespider |
ByteDance |
Model training |
|
meta-externalagent |
Meta |
Model training |
To block AI training crawlers while keeping search crawlers
User-agent: GPTBot Disallow: / User-agent: ClaudeBot Disallow: / User-agent: Google-Extended Disallow: / User-agent: CCBot Disallow: / User-agent: * Allow: /
Common Configuration Examples
Standard site, allow everything
User-agent: * Disallow: Sitemap: https://example.com/sitemap.xml # An empty Disallow means nothing is blocked. # This is the safe default.
WordPress
User-agent: * Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php Sitemap: https://example.com/sitemap_index.xml # admin-ajax.php must stay crawlable. Many themes and # plugins rely on it to render pages correctly.
Ecommerce, reducing crawl waste
User-agent: * Disallow: /cart Disallow: /checkout Disallow: /*?sort= Disallow: /*?filter= Disallow: /search Sitemap: https://example.com/sitemap.xml # Faceted navigation can generate thousands of near-identical # URLs. This is where crawl budget usually leaks.
Staging site, block everything
User-agent: * Disallow: / # This blocks the entire site. Never deploy it to production. # Adding HTTP authentication to staging is more reliable, # since robots.txt depends on crawler cooperation.
File Requirements
|
Requirement |
Detail |
|
Location |
Root of the host: https://example.com/robots.txt |
|
Filename |
Exactly robots.txt, all lowercase |
|
Format |
Plain text, UTF-8 |
|
Response code |
Must return 200 |
|
Size limit |
Google reads the first 500 KiB |
|
Scope |
Per protocol, host, and port |
Subdomain scoping causes more confusion than any other rule
A robots.txt at example.com does NOT apply to blog.example.com, shop.example.com, or www.example.com if those resolve separately. Each host needs its own file.
Common Mistakes to Avoid
This is the most damaging robots.txt mistake and it is extremely common. Blocking a URL stops it being crawled, not listed. Worse, if the page already carries a noindex tag, disallowing it means the crawler can never fetch the page to see that tag, so the page stays in the index permanently. To remove a page: allow crawling, add noindex, wait for recrawl, and only disallow afterwards if you want to save crawl budget.
Blocking /assets/, /wp-content/themes/, or /wp-content/plugins/ was standard advice a decade ago and is actively harmful now. Google renders pages the way a browser does, and it needs your stylesheets and scripts to do that. Block them and Google sees a broken, unstyled page, which affects how it assesses layout, mobile usability, and content. Leave asset directories crawlable.
Anyone can read yourdomain.com/robots.txt. Writing Disallow: /admin-backup-2024/ publishes the exact location of something you wanted hidden, and attackers routinely check robots.txt for precisely this. Protect sensitive areas with authentication or server rules. If something must not be found, its path does not belong in a public text file.
Quick Reference
|
Item |
Detail |
|
Location |
Site root, lowercase filename |
|
Disallow |
Blocks crawling, not indexing |
|
To deindex |
Use noindex, keep crawlable |
|
Crawl-delay |
Google ignores it |
|
Noindex: in robots.txt |
Dead since 2019 |
|
Rule precedence |
Longest matching rule wins |
|
Tie-break |
Allow beats Disallow |
|
Subdomains |
Need their own file |
|
Missing file |
Means crawl everything |
|
Size limit |
500 KiB |
|
Never block |
CSS or JS |
|
Privacy |
The file is publicly readable |
