Step-by-step guide: How to Create a Robots.txt File (with Examples)
How to use the Robots.txt Generator
- Choose a rule for all crawlers: allow everything, block specific paths, or block the whole site (useful for a staging copy).
- If you are blocking paths, enter one per line, such as
/admin/or/*?sessionid=. Add exceptions in the second box if part of a blocked folder should stay crawlable. - Tick any crawlers you want to keep out entirely, such as AI training crawlers, and add any other user-agent names.
- Add the full address of each sitemap so crawlers can find them.
- Review the generated file on the right. You can edit it directly, then test any path with the tester to confirm the result.
- Download the file, name it exactly
robots.txt, and upload it to the root of your domain so it is available athttps://your-domain/robots.txt.
Example: an online shop
A shop wants search engines to crawl products and categories, but not the basket, checkout or endlessly sortable filter URLs. It also wants to opt out of one AI training crawler:
User-agent: *
Disallow: /cart/
Disallow: /checkout/
Disallow: /*?sort=
Allow: /checkout/help/
User-agent: GPTBot
Disallow: /
Sitemap: https://www.example-shop.com/sitemap.xml
Testing /checkout/help/returns for Googlebot returns Allowed, because the longer Allow: /checkout/help/ rule beats the shorter Disallow: /checkout/ rule. Testing /shoes?sort=price returns Blocked by /*?sort=.
What robots.txt does — and what it does not
A robots.txt file is a plain-text set of instructions at the root of a website that tells well-behaved crawlers which URLs they may request. It is mainly used to keep crawlers away from low-value or duplicate URLs, such as internal search results and filter combinations, so they spend their time on pages that matter.
Two misunderstandings cause real problems:
- Blocking is not the same as hiding. A URL blocked in robots.txt can still appear in search results, without a description, if other sites link to it. To keep a page out of search results, allow crawling and add a
noindexrobots meta tag instead. - It is not security. The file is public and compliance is voluntary. Never rely on it to protect private content; use authentication.
How the tester decides
The tester follows the Robots Exclusion Protocol as standardised in RFC 9309, which Google and Bing follow:
- It finds the group whose
User-agentline matches the crawler name most specifically. A group forGooglebottakes precedence over the*group; the crawler follows only one group. - Within that group, it compares the path with every
AllowandDisallowrule, treating*as any sequence of characters and$as the end of the URL. - The matching rule with the longest path wins. If an allow and a disallow rule are equally long, allow wins.
- If no rule matches, the path is allowed.
Paths are case-sensitive, so /Admin/ and /admin/ are different rules.
About blocking AI crawlers
Several AI companies publish the user-agent names of the crawlers they use to collect training data, and state that those crawlers respect robots.txt. The generator includes a selection of these names. Blocking them only affects crawlers that choose to comply, and some products use separate user-agents for training, search and fetching pages on a user’s request, so check each company’s current documentation if this matters to you.
Limitations to keep in mind
- Crawlers are not obliged to follow robots.txt. Reputable search engines do; malicious bots generally do not.
- The tester implements the standard matching rules used by major search engines. Smaller crawlers may interpret wildcards or conflicting rules differently.
- Crawl-delay is ignored by Google. To reduce Googlebot’s crawl rate, your server can temporarily respond with HTTP 503 or 429 status codes.
- The list of crawler names reflects published names at the time of writing. Companies add and rename crawlers, so review the list periodically.
How your data is handled
The robots.txt file is generated and tested in your browser. Nothing you enter is sent to a server, and the tool does not fetch your live robots.txt file.
Frequently asked questions
Where do I upload robots.txt?
To the root directory of your website, so it is reachable at https://www.your-domain.com/robots.txt. A robots.txt in a subfolder is ignored. Each subdomain, such as shop.your-domain.com, needs its own file.
Should I block CSS and JavaScript files?
No. Search engines render pages much like a browser does and need your CSS and JavaScript to understand layout and content. Blocking them can make pages look broken to crawlers.
How quickly do changes take effect?
Google generally caches robots.txt for up to 24 hours, so changes are usually picked up within a day. You can ask Google to refresh it sooner from the robots.txt report in Search Console.
What does an empty Disallow line mean?
Disallow: with nothing after it allows everything for that group. It is the traditional way of writing “no restrictions” and is equivalent to Allow: /.
Can I test my existing robots.txt?
Yes. Paste your current file into the output box, replacing the generated content, and use the tester. It tests whatever is in the box.