Writing a robots.txt file is only half the job. The other half is testing it, because a file that looks right can still block the wrong crawler, allow the wrong page, or sit unread while a firewall blocks everything anyway. Testing is how you find out what crawlers can actually do on your site, instead of what you hope they can do.
This guide gives you a test you can run in an afternoon, with no special tools beyond a browser, a terminal, and access to your server logs and Search Console. It tests the file itself, the matching rules, the edge, and the real visits, in that order, so a failure at any step points to the right fix.
The short answer
Test in four layers. First, fetch the file in a browser and read it. Second, check each important URL against the rules, using Google Search Console for Googlebot and a local parser for the AI tokens. Third, fetch a page as if you were a crawler, with a crawler user agent, and see what the server actually returns. Fourth, search your server logs for real crawler visits, and check the source addresses against the vendor published IP ranges.
Google no longer offers the old standalone robots.txt Tester as a separate tool. The current route is the robots.txt report in Search Console, under Settings, which shows the files Google found, when each was last checked, its fetch status, and any errors or warnings, plus URL Inspection, which reports Blocked by robots.txt for a live URL under your verified property. That is the authoritative test for Googlebot. For AI crawlers, there is no single vendor tester that covers them all, so the log check and the user agent fetch in this guide are the tests that matter.
The matching rules you are testing come from RFC 9309, the Robots Exclusion Protocol. A crawler must use case insensitive matching to find the group that matches its product token, and if no matching group exists, it must obey the group with a star value, if present. The most specific matching rule wins, and if an allow rule and a disallow rule are equivalent, the allow rule should be used. If no rule matches, the page is allowed. Google adds that it supports only user-agent, allow, disallow, and sitemap in robots.txt, and that other fields such as crawl-delay are not supported.
How it works, step by step
Step one is the file fetch. Open your own domain followed by robots.txt in a browser, in a private window, so you see the live file and not a cached copy in your browser. Read it line by line. Check that the file loads with a 200 status, not a 404 and not a server error. A 404 means no file exists, and crawlers may read anything. A 5xx server error means crawlers must assume they may fetch nothing, under RFC 9309, which is the opposite of what most owners expect from an error. Check that each group is complete, that tokens are spelled correctly, and that no Allow or Disallow line sits before the first User-agent line, because RFC 9309 says a crawler should ignore rules that are not in any group.
Step two is the rule check for Googlebot. Open Google Search Console, select your verified property, and open the robots.txt report under Settings. It shows each robots.txt file Google found, when it was last checked, its fetch status, and any issues. If the report shows an error, fix the file and request a recrawl from the same report. Then test a single live URL with URL Inspection. Paste the full page address into the URL Inspection bar, run the test, and read the coverage result. If robots.txt blocks the page, the result says Blocked by robots.txt. Use Test Live URL to force a fresh fetch against the currently deployed file, which bypasses the cached copy Google usually holds for up to 24 hours.
Step four is the fetch as a crawler. A file can be correct and still useless if a firewall blocks the crawler before it reaches your server. Test that by fetching a page with a crawler user agent string, using curl from a terminal. The code block later in this guide shows the exact command, using the PerplexityBot user agent string published by Perplexity. A 200 response means the edge let the request through. A 403, a challenge page, or a redirect to a captcha means something upstream blocked it, no matter what robots.txt says. Repeat the test with the OAI-SearchBot user agent string published by OpenAI, and with a normal browser user agent, and compare the three results. If the browser gets 200 and the crawlers get blocked, the edge is the problem.
Step five is the log check, which is the only test that proves a real crawler visited. Search your server access logs for the tokens, using grep, as shown in the code block below. Look for the token, the path, the status code, and the source address. A 200 for a product page means the crawler read it. A 403 means it was blocked at the edge. No lines at all, after a week or two, means something upstream is still blocking, or the crawler has not tried yet. Check the source address against the vendor published IP ranges: OpenAI publishes a JSON file for each of its bots, Perplexity publishes a JSON file for each of its bots, and Anthropic publishes a JSON list of its crawler addresses. A user agent string alone proves nothing, because anyone can send a fake one, so match the address as well as the name.
Step six is the timing check. Do not judge a change on the same day you make it. OpenAI says it can take about 24 hours from a robots.txt update for its systems to adjust for search. Perplexity says it may take up to 24 hours for its systems to reflect a change. Meta says to allow up to 24 hours because its crawlers may cache the file. Google generally caches the file for up to 24 hours. Run the file fetch and the crawler fetch on the day you change it, then run the log check the next day, and again a week later.
What to do on your site
Make a short test list before you start, and write it down. List the pages that must be allowed, such as the homepage, two product pages, and one guide page. List the pages that must be blocked, such as the cart, the checkout, and the admin area. List the crawlers you care about, by token, not by company name. A test without a list is a test you will forget halfway through.
Then run the four layers in order, and record the result of each one. File loads, with the rules you expect. Googlebot check in Search Console, with Allowed or Blocked for each test URL. Crawler fetch with curl, with the status code for each token. Log check, with the number of visits per token and the status codes they received. A written record turns a vague feeling that something is wrong into a specific failure you can fix.
A worked example
Imagine a coffee roaster called Northbean Coffee that sells beans online and runs a small cafe. The owner allows AI search crawlers in robots.txt, but the shop never appears in AI answers. The owner runs the test in this guide.
The file fetch works. The file loads, the groups are there, and the tokens are spelled correctly. The Googlebot check in Search Console shows the product pages as Allowed. So far, so good. Then the owner runs the crawler fetch with the PerplexityBot user agent, and gets a 403 response with a challenge page, while a normal browser user agent gets a 200. The file is right, but the edge is blocking the crawler.
The owner opens the bot management settings, finds a rule that challenges all automated traffic, and adds an allow rule for the PerplexityBot token and its published IP ranges, following the WAF guidance Perplexity publishes in its crawler docs. The next day the crawler fetch returns 200. A week later the log check shows PerplexityBot visits with 200 status codes on the product pages, and the shop starts to appear in Perplexity answers.
The lesson is that the owner tested the right layer. If the owner had only re-read the file, the file would have looked perfect, and the real problem would have stayed hidden. Testing the file, the edge, and the logs separately is what found the failure, and it found it in one afternoon.
The machine readable part
Copy the block below into a terminal to test your site. Replace yourdomain.com with your own domain. The first command fetches your homepage as PerplexityBot. The second fetches it as OAI-SearchBot, using the user agent string OpenAI publishes. The third searches your server logs for the main AI tokens. Only use the user agent strings exactly as published, because a made up string tests nothing.
curl -A "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; PerplexityBot/1.0; +https://perplexity.ai/perplexitybot)" -I https://www.yourdomain.com/
curl -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36; compatible; OAI-SearchBot/1.4; +https://openai.com/searchbot" -I https://www.yourdomain.com/
grep -i "oai-searchbot\|claude-searchbot\|perplexitybot\|meta-webindexer\|googlebot\|bingbot" /var/log/nginx/access.log
Read the results this way. A 200 response from curl means the edge let the request through. A 403, a challenge page, or a redirect to a captcha means it did not. In the log search, a line with a token and a 200 means the crawler read that page. A line with a token and a 403 means it was blocked. No lines at all means no visits in that log file for that period, which is a finding in itself, not a blank. If your server uses Apache instead of Nginx, the log path will differ, so ask your host or developer for the right path before you run the grep command.
Mistakes to avoid
Mistake one is testing only the file. A correct file with a blocking firewall is still a blocked site. Test the file, the edge, and the logs, in that order, every time.
Mistake two is trusting the old robots.txt Tester. Google retired the standalone Tester, and the current route is the robots.txt report plus URL Inspection in Search Console. A guide that tells you to open the old Tester is out of date, and following it will waste your afternoon.
Mistake three is judging a change too soon. Vendors cache robots.txt, and OpenAI, Perplexity, Meta, and Google all describe a wait of about a day before changes take effect. A retest ten minutes after a change proves nothing. Retest the next day.
Frequently Asked Questions
How do I know if my robots.txt file exists?
Open your own domain followed by robots.txt in a browser. If a page with rules loads, the file exists. If you see a not found error, it does not exist yet. If you see a server error, fix the server error first, because crawlers must assume they may fetch nothing when the file returns a server error, under RFC 9309.
What replaced the old robots.txt Tester in Search Console?
The robots.txt report under Settings, which shows the files Google found, their fetch status, and any errors, plus URL Inspection, which reports Blocked by robots.txt for a live URL. Use the report to check the file, and URL Inspection to check a single URL.
Can I test AI crawlers in Search Console?
No. Search Console tests Googlebot only. For AI crawlers, use the curl fetch with the published user agent string, and the server log check with the vendor published IP ranges. Those two tests together are the reliable check for AI tokens.
Verified Sources & Technical Documentation
- RFC 9309, Robots Exclusion Protocol Specific https://www.rfc-editor.org/rfc/rfc9309.html
- Google Search Central: create and submit a robots.txt file Specific https://developers.google.com/search/docs/crawling-indexing/robots/create-robots-txt
- Google Search Central: how Google interprets the robots.txt specification Specific https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt
- OpenAI bots documentation Specific https://platform.openai.com/docs/bots
- Perplexity crawlers documentation Specific https://docs.perplexity.ai/guides/bots
- Google robots.txt parser and matcher library General Docs https://github.com/google/robotstxt
- Search Console help: robots.txt report General Docs https://support.google.com/webmasters/answer/6062598
links marked specific point to the page that supports the claim in this guide. Links marked general docs point to the vendor's general docs section for that topic, not to a page that proves every step. Check the vendor docs for the current path before relying on a menu name or click path in this guide.