How to use the robots.txt generator
- Start from a preset that’s closest to your site.
- Edit each group: user agents (one per line,
*for all), paths to disallow and exceptions to allow. - Add more groups for crawlers that need different rules.
- List your sitemap URLs, which must be full URLs.
- Test URLs with the tester: type a path, choose a crawler and see Allowed or Blocked with the deciding rule.
- Download
robots.txtand upload it to your site’s root.
How the rules work
A robots.txt file is a list of groups. Each group starts with one or more User-agent lines followed by Disallow and Allow rules:
User-agent: *
Disallow: /admin/
Allow: /admin/public/
User-agent: GPTBot
Disallow: /
Sitemap: https://www.example.com/sitemap.xml
A crawler uses only the group that matches its name most specifically, and falls back to * if no group names it. Rules are path prefixes: /admin/ blocks everything under that folder. * matches any characters and $ anchors the end, so /*.pdf$ blocks PDF files but not /file.pdf?download=1. An empty Disallow: allows everything.
The tester follows these rules: most specific group, longest matching rule, Allow winning ties.
Worked examples
Example 1: a typical business site
The default preset blocks /admin/, /cart/ and /search for all crawlers. Internal search results and carts add nothing to search engines and waste crawl budget. Test /admin/settings and it’s blocked by Disallow: /admin/; test /blog/ and it’s allowed because no rule matches.
Example 2: blocking AI training crawlers
Load Block AI crawlers. Test /blog/ with GPTBot and it’s blocked by Disallow: / in the AI group. Test the same path with Googlebot and it’s allowed. Note that Google-Extended controls the use of your content for Google’s AI models without affecting Google Search.
Example 3: WordPress
The WordPress preset blocks the admin area but allows admin-ajax.php, which themes and plugins use for front-end features. Test /wp-admin/admin-ajax.php: the Allow rule is longer than the Disallow rule, so it wins.
Things robots.txt can’t do
- Hide private content. The file is public and lists exactly what you’d rather hide. Use authentication.
- Remove pages from search results. Use
noindex, and make sure the page isn’t blocked so crawlers can see the tag. - Control badly behaved bots. Compliance is voluntary; block abusive traffic at the server or firewall.
Common mistakes
Disallow: /left over from staging on a live site.- Blocking CSS and JavaScript, which stops Google from rendering pages properly.
- Relative sitemap URLs. The
Sitemap:line needs a full URL. - Paths without a leading slash, which are ignored.
- Relying on
Crawl-delayfor Google, which ignores it.