Guide
Writing a robots.txt file and testing which paths it blocks
Every site is visited by crawlers: search engines, tools, AI services and scrapers. A file named robots.txt, placed at the root of your site, tells well-behaved ones which paths to leave alone. It is short, but small mistakes can hide a whole site from search, so it is worth checking a file against real paths before you upload it. This page writes the file from a form and tests an existing file, showing which line decides each path.
Writing the file
Choose “Write a robots.txt file”, then either start from a preset or fill in the boxes. User agents go one per line, with * meaning every crawler. Paths to block and exceptions to allow go in their own boxes, and a sitemap address adds a Sitemap: line. The WordPress preset blocks /wp-admin/, the search page /?s= and /search/, and allows /wp-admin/admin-ajax.php, which many themes need. The AI crawler preset writes a group for GPTBot, CCBot, Google-Extended, ClaudeBot and PerplexityBot that disallows everything, followed by a group that leaves other crawlers unrestricted.
How rules are matched
RFC 9309, the standard for the file, defines the matching. A crawler uses the group whose user-agent line matches it most specifically, and falls back to *. Within the group it finds every rule whose pattern matches the path from the start. The longest pattern wins, and when an Allow and a Disallow are the same length, Allow wins. A * in a pattern stands for any run of characters and a $ at the end anchors the pattern to the end of the path. An empty Disallow allows everything.
Testing a file
Switch to “Test a robots.txt file”, paste your rules, choose a user agent and list paths one per line. The table shows each path as Allowed or Blocked and quotes the rule that decided it, or says that no rule matches. That makes surprises easy to find, such as a pattern with a missing slash that blocks more than you meant.
A worked example
The test sample holds a group for all crawlers with Disallow: /private/, Allow: /private/public.html and Disallow: /*.pdf$, plus a group for Googlebot-Image. Five paths are checked: /private/report.html is blocked by Disallow: /private/; /private/public.html is allowed because the longer Allow pattern beats the folder rule; /docs/guide.pdf is blocked by the PDF pattern; /docs/guide.pdf?v=2 is allowed because the $ anchor does not match a path that continues with a query; and /blog/ matches no rule. The result row reads three allowed and two blocked.
What robots.txt cannot do
It does not hide pages. A blocked address can still appear in results if other pages link to it, and anyone can read your robots.txt, so never list secret paths in it. It is also a request: reputable crawlers follow it, but others ignore it, and the list of AI crawler names changes, so the preset is only a starting point. If you need a page out of search, use a noindex directive on a page the crawler may fetch, or password protection.
Limits
The tester implements the matching rules of RFC 9309 and does not know about extra directives that individual crawlers add. It does not fetch your live file, so paste the text you plan to upload. Nothing you type is sent anywhere.
Related tools
- XML Sitemap Generator builds the sitemap that the Sitemap line points to.
- Canonical Tag Generator handles duplicate addresses that robots.txt should not hide.
- Redirect Generator writes server rules for moved pages.
- Sitemap to CSV turns a sitemap into a list you can compare with your blocked paths.
Checked against the current version of the robots.txt Generator and Tester on .

