How to use the Robots.txt Generator
- Choose the default rule
- Add disallowed paths and bots
- Copy or download robots.txt
Build a robots.txt file
Choose whether robots may crawl everything or nothing, list paths to block (one per line) and paths to always allow, add an optional crawl delay and your sitemap URL, and tick Block AI training crawlers to add rules for GPTBot, ClaudeBot, CCBot, Google-Extended and other AI bots. Copy the result or download it as a ready robots.txt file.
What is robots.txt?
It is a plain text file at the root of your site that tells crawlers which pages they may visit. Before crawling, a bot reads yoursite.com/robots.txt and follows the rules for its user-agent. It must sit at the root of the domain; it won't work in a sub-folder.
Example
User-agent: * Disallow: /admin/ Allow: /admin/help/ Sitemap: https://example.com/sitemap.xml
Disallow: / blocks the whole site, and an empty Disallow: allows everything. Google ignores Crawl-delay; Bing respects it.
AI crawlers
The AI option adds a Disallow: / group for each AI crawler. Be aware that it also blocks AI search bots such as OAI-SearchBot and PerplexityBot, so your pages may stop appearing in AI answers โ remove those lines if you want that traffic.
Blogger, WordPress and Cloudflare
- Blogger โ Settings โ Crawlers and indexing โ turn on โEnable custom robots.txtโ, then paste. Keep
Disallow: /searchso label pages aren't indexed. - WordPress serves a virtual file; edit it with your SEO plugin's file editor, or upload a real file to the site root.
- Cloudflare can add AI-bot rules to your robots.txt automatically; check the result after turning it on.
Do you need one?
Not strictly โ without one, everything may be crawled โ but it's good practice for the sitemap line. It isn't security or a legal barrier: it's a request that well-behaved bots follow. To keep a page out of Google, use a noindex tag instead. Never block CSS, JavaScript or pages you want to rank, and check your file with Search Console's robots.txt report.
Ready-made files for common sites
WordPress. Keep the admin area out of crawls but leave the AJAX file open, because themes and plugins load content through it:
User-agent: * Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php Sitemap: https://example.com/wp-sitemap.xml
WordPress has served /wp-sitemap.xml since version 5.5. If you use Yoast or Rank Math, point the Sitemap line at /sitemap_index.xml instead.
Online shop. Block cart, checkout and account pages, plus filtered URLs that create thousands of near-identical pages: Disallow: /cart, Disallow: /checkout, Disallow: /*?sort=. Shopify generates its own file; to change it you edit the robots.txt.liquid template in your theme.
Staging site. Disallow: / keeps a test copy out of crawls, but remove it the day you launch. Forgetting this line is one of the most common reasons a new site never appears in Google.
How Google reads your rules
- The most specific rule wins. With
Disallow: /admin/andAllow: /admin/help/, the longer Allow rule applies to the help pages. If two rules are equally long, Google uses Allow. - Wildcards.
*matches any characters and$marks the end of the URL, soDisallow: /*.pdf$blocks every PDF. - Paths are case-sensitive.
/Admin/and/admin/are different rules. - Each subdomain needs its own file. shop.example.com does not use the rules at www.example.com.
- Changes take a little time. Google usually caches robots.txt for up to a day, so a fix is not seen instantly.
Frequently asked questions
Where do I upload robots.txt?
In the root folder of your domain, so it opens at https://yourdomain.com/robots.txt. A file in a sub-folder such as /blog/robots.txt is ignored by crawlers.
Will robots.txt remove a page from Google?
No. A blocked page can still be indexed without its content if other sites link to it. To remove a page, let Google crawl it and add a noindex meta tag, or use the Removals tool in Search Console.
Should I block AI crawlers?
Only if you do not want your content used for AI training. Blocking is a choice, not an SEO requirement. Remember that blocking AI search bots can also stop your pages appearing in AI answers.