Robots.txt Generator

Use this robots.txt generator to build a correct robots file for your site — crawler rules, blocked folders, crawl-delay and your sitemap — with one-click presets, including one that blocks AI crawlers.

1Start from a preset or build your own rules
2Add the paths to block or allow
3Copy or download robots.txt to your site root

Private by design: 100% in your browser — nothing is uploaded, no sign-up. This tool runs entirely on your device.

How to use this robots.txt generator

Most sites should start from the custom rules, not a preset: leave the user-agent as * (every crawler), list the folders that are nobody's business — admin areas, checkout and internal search results are the usual three — and add your sitemap address at the bottom. The generator assembles the file as you type, keeping an empty Disallow line in place when you block nothing, because a group with no Disallow at all confuses some parsers. The presets are for special situations: allow-all for a site with nothing to hide, block-all for a staging site that must never be indexed, and block-AI for publishers who are happy to be found by search engines but not crawled for AI training. Download the result and place it at the very root of your domain.

Before it goes live, read the file once as if you were a crawler. Rules are matched group by group, paths are case-sensitive prefixes, and the longest matching rule wins when Allow and Disallow overlap. Thirty seconds of reading prevents the two classic accidents: blocking the whole site with a stray slash, and blocking the CSS and JavaScript files your pages need to render (which makes Google see a broken page).

Example output

With the sample values on this page — block /admin/, /checkout/ and /search/ for everyone, but allow one help page inside admin, plus the sitemap — the generator produces:

User-agent: * Disallow: /admin/ Disallow: /checkout/ Disallow: /search/ Allow: /admin/help.html Sitemap: https://yourwebsite.com/sitemap.xml

And the block-all preset produces exactly two lines, which this tool's own code was tested against:

User-agent: * Disallow: /

That single slash is the whole site. It is the right content for a staging server and a catastrophe on a live one — which is why this preset is a deliberate choice in a dropdown, never a default.

How crawlers read the file

A crawler arriving at your site asks for /robots.txt first and finds the group addressed to its own user-agent name; if there is none, it follows the * group. Within a group, it compares each path it wants against the Disallow and Allow lines and obeys the longest match. Nothing in the file can force a crawler to visit anything — robots.txt only ever says "keep out", never "come here" (the Sitemap line is a hint, not an instruction). It is also worth knowing what the file is not: it is not security. The contents are public — anyone can read your robots.txt — so listing a hidden folder in it advertises the folder to exactly the people you least want finding it. Block crawlers from it if you like, but lock it properly as well.

The AI crawler question

The block-AI preset exists because the trade changed: AI companies crawl the open web to train models and to answer live questions, and publishers reasonably want a say. The known, self-identifying AI agents — GPTBot, ClaudeBot, CCBot, Google-Extended, PerplexityBot and others in the preset — declare who they are and honour robots.txt, so a Disallow group for each is an effective, standard way to opt out of training crawls while staying fully visible in search. Two honest caveats: blocking Google-Extended does not affect normal Google Search, which uses Googlebot; and no robots rule can stop an agent that chooses to ignore the protocol. The file records your preference in the web's own language — well-behaved crawlers respect it.

Groups, order and wildcards

Two details of the format reward a minute's attention. First, grouping: rules belong to the user-agent line above them, and a blank line ends the group. A Disallow typed under the wrong agent is a common silent failure — the file looks right, but Googlebot never sees the rule meant for it, or sees one meant for somebody else. This generator keeps your custom rules in a single clearly headed group for that reason. Second, wildcards: most major crawlers accept * inside a path to mean "anything here", and a trailing $ to mean "the path must end here" — so Disallow: /*? blocks parameter URLs, and Disallow: /print$ blocks exactly the print page. Use them sparingly and test afterwards in Search Console's tester, because wildcard dialects differ slightly between crawlers and a clever pattern that misfires can block far more than you intended.

Frequently asked questions

Where does the robots.txt file go?

In the root of your domain, so it is reachable at yourdomain.com/robots.txt — nowhere else is read. It must be a plain text file served with a 200 status. Each subdomain needs its own file, and a site can only have one: crawlers never look in subfolders.

Does robots.txt hide a page from Google completely?

No. A Disallow rule stops crawlers from fetching the page, but if other sites link to it, the URL can still appear in results (without a description). To remove a page from the index properly, use a noindex meta tag or password-protect it — and do not block it in robots.txt, because the crawler must be able to fetch the page to see the noindex.

What is the difference between Disallow: / and an empty Disallow?

Disallow: / blocks the entire site for that user-agent — one slash makes the whole domain off-limits. An empty Disallow: (nothing after the colon) means 'nothing is disallowed', which is how you write allow-everything. Confusing the two is the most expensive typo in SEO: sites have vanished from Google by shipping a block-all file to production.

How do I block a single folder or page?

Add a Disallow line with the path, starting with a slash: Disallow: /admin/ blocks everything under the admin folder, and Disallow: /checkout.html blocks that one page. Paths are case-sensitive and matched as prefixes, so /private also blocks /private-things unless you are precise.

Does Google respect crawl-delay?

Googlebot ignores the crawl-delay directive — Google asks you to manage crawl rate in Search Console instead. Bing and several other crawlers do honour it. Including it is harmless for Google and useful for the crawlers that read it, which is why the generator offers it as an optional line.

How do I block AI crawlers like GPTBot?

Give each AI crawler its own group with Disallow: / — the 'block AI crawlers' preset in this generator writes them for GPTBot, ClaudeBot, CCBot, Google-Extended, PerplexityBot and other known AI agents, while leaving search engines untouched. Well-behaved AI crawlers honour robots.txt; it is a request, not a technical barrier, so it cannot stop scrapers that ignore the rules.

Should I add my sitemap to robots.txt?

Yes. A Sitemap: line with the full URL of your sitemap is the simplest discovery hint you can give every crawler at once, including ones you have no webmaster-tools account with. It does not guarantee indexing, but it guarantees the crawler knows where your page list lives.

Can robots.txt stop bad bots and scrapers?

Only the polite ones. Robots.txt is a voluntary protocol: legitimate crawlers (Google, Bing, reputable AI agents) obey it, malicious bots simply ignore it — and some even read it to find the folders you marked as sensitive. Never list secret paths in robots.txt as a security measure; protect them with real authentication instead.

How do I check my robots.txt is working?

Visit yourdomain.com/robots.txt in a browser to confirm the file you generated is the one being served, then use the robots.txt tester in Google Search Console (or Bing Webmaster Tools) to test specific URLs against your rules. Test after every change — one misplaced slash can block a whole section.

Related tools