Robots.txt Generator

Build a correct robots.txt with allow/deny rules, sitemap and AI-bot presets.

Runs in your browserUpdated Built and maintained by Leon and Henrik

Build a correct robots.txt with allow and disallow rules, a sitemap line and one-click AI-crawler presets — then test any path against it, all in your browser. Free. No sign-up. Runs in your browser, nothing is uploaded.

Robots.txt Generator

User-agent groups

One path per line. Leave Disallow empty to allow everything for this agent.

AI crawler presets

Selected bots get a blanket Disallow: / appended for that user-agent.

Generated robots.txt

User-agent: *
Disallow:

Test a path

A crawler follows only the group that names it most specifically, or the * group if none does. Inside that group the longest matching rule wins, and Allow beats Disallow on a tie. The * and $ wildcards work.

Runs in your browser
Nothing is uploaded

A robots.txt file tells crawlers which URLs on your host they may request. This generator writes a valid one from a form, adds one-click blocks for the common AI crawlers, and has a path tester that tells you whether a given URL is allowed for a given bot, and which rule decided it. Check your important URLs in the tester before you upload the file; a single stray Disallow: / can take a whole site out of search.

The rules in two minutes

A robots.txt is a list of groups. Each starts with a User-agent line and contains the rules for that crawler:

  • Disallow: /admin/ blocks every URL that starts with /admin/. An empty Disallow: blocks nothing.
  • Allow: carves an exception out of a broader Disallow.
  • Crawl-delay: asks for a pause in seconds between requests. Optional, and ignored by Google.
  • Sitemap: gives the absolute URL of your XML sitemap. It belongs to no group, so the generator puts it at the end.

Two details catch people out. First, a crawler obeys only one group: the one that names it, or * if none does. A User-agent: Googlebot group does not inherit anything from *, so a Googlebot group that only re-allows one folder silently allows everything else too. Second, if you create two groups with the same user-agent, crawlers following the current standard (RFC 9309) merge them. The generator does the same: it writes one combined group per crawler name.

Which rule wins: worked examples

Inside a group, the longest matching rule wins, and on a tie Allow beats Disallow. The tester supports the two wildcards that Google and the standard recognise: * for any sequence of characters and $ for "end of URL".

User-agent: *
Disallow: /downloads/
Allow: /downloads/free-guide.pdf
Disallow: /*.zip$
Path testedResultDeciding rule
/downloads/report.pdfDisallowedDisallow: /downloads/
/downloads/free-guide.pdfAllowedAllow: /downloads/free-guide.pdf (longer)
/files/backup.zipDisallowedDisallow: /*.zip$
/files/backup.zip?v=2Allowedthe $ anchor no longer matches, and no other rule does
/blog/Allowedno matching rule

The ?v=2 row is the one worth remembering: a $ anchor makes a pattern strict, and query strings break it. The tester matches the user-agent you type against the group names exactly (ignoring case), so type GPTBot, not a full browser-style user-agent string.

AI crawlers: training, search and user fetches are different bots

The presets add a Disallow: / group for GPTBot, ClaudeBot, PerplexityBot, Google-Extended, CCBot (Common Crawl, whose open dataset is widely used for model training) and Bytespider (ByteDance). What a block actually achieves depends on the company, because several now run separate crawlers for separate jobs:

CompanyTrainingSearch / answer indexFetch on a user's request
OpenAIGPTBotOAI-SearchBotChatGPT-User (robots.txt "may not apply", per OpenAI)
AnthropicClaudeBotClaude-SearchBotClaude-User
GoogleGoogle-Extended (a control token, not a separate crawler)Googlebot, i.e. normal Search—

So the GPTBot preset opts you out of OpenAI training but leaves you eligible for ChatGPT search, which many publishers want for the referral traffic. If you want out of AI search too, add a group with the search crawler's name and Disallow: /. Blocking Google-Extended, by Google's own documentation, does not touch your Search inclusion or rankings.

None of this is enforcement. The big AI companies document that their training crawlers honour robots.txt; a scraper that ignores the file is not stopped by it.

Mistakes that cost traffic

  • Blocking CSS and JavaScript. Google renders pages; if it cannot fetch your stylesheets and scripts, it may misjudge the page. Disallow admin and internal-search paths, not assets.
  • Using Disallow to de-index. A disallowed URL can still appear in results if other sites link to it, just without a description. To remove a page from the index, let it be crawled and add a noindex robots meta tag; Google cannot see the noindex on a page it is not allowed to fetch.
  • Shipping the staging file. User-agent: * plus Disallow: / is the standard staging setup and the most common reason a relaunched site vanishes. Test / in the tester before every deploy.
  • Trusting a 403. Google treats a robots.txt that returns any 4xx error except 429 as if no file existed, which means no restrictions. A 5xx error is the opposite: Google pauses crawling and falls back to its last cached copy.
  • Expecting instant effect. Google generally caches robots.txt for up to 24 hours, and it reads at most the first 500 KiB of the file.

Uploading the file

Copy or download the result as robots.txt (plain text, UTF-8) and put it in your web root so it loads at /robots.txt. On most CMSs you can also edit it through an SEO plugin. Then open https://yourdomain.com/robots.txt in a browser to confirm it is live, and use the Robots.txt report in Google Search Console to see which version Google fetched. Add your sitemap line while you are at it; it is the easiest way to point every compliant crawler at your full URL list.

Frequently asked questions