Practical guideUpdated 2026-09-15

How to test and validate a robots.txt file

To test a robots.txt file, fetch it at yourdomain.com/robots.txt, confirm it returns 200 with a text content type, then check each User-agent group's Allow and Disallow rules against the URLs you care about using a robots.txt tester such as SerionFlow's free checker or Google Search Console's report. Validate syntax, path matching, wildcards, and the Sitemap line, and test the AI crawler user agents separately.

A robots.txt error is cheap to make and expensive to discover, because the symptom is pages quietly dropping out of crawl schedules weeks later. This guide covers how to fetch and validate the file, how Google and Bing actually parse it, how to test a specific URL against a specific user agent, the mistakes that appear most often, and how to check the AI crawler directives that now matter for GEO as well as SEO.

01

What robots.txt does and does not control

robots.txt tells crawlers which paths they may request. It does not remove pages from the index; a page blocked by robots.txt can still be indexed from links and shown with no snippet. To keep a page out of results, use a noindex meta tag or X-Robots-Tag header and let it be crawled. To stop crawlers hitting expensive endpoints such as /api/ or faceted search, robots.txt is the right tool.

It is also advisory. Well-behaved crawlers from Google, Bing, and the main AI companies obey it; scrapers do not. Treat it as crawl management, not security.

02

Step one: confirm the file is reachable and served correctly

Request https://yourdomain.com/robots.txt directly. It must return HTTP 200 with a text/plain content type and be under 500 KiB, which is Google's parsing limit. A 404 is treated as "allow everything"; a 5xx or timeout makes Google treat the site as fully disallowed until the file recovers, which is the single most damaging robots.txt failure. Check that the www and non-www hosts and the http and https schemes all serve the same file, since each host-scheme pair is a separate robots.txt in the protocol.

03

Step two: validate the syntax and structure

The file is groups of lines. Each group starts with one or more User-agent lines followed by Allow and Disallow rules, and Sitemap lines can appear anywhere. Common syntax faults are a rule before any User-agent line, a Disallow with no path (which allows everything), Windows line endings mixed with Unix, and a byte-order mark at the start of the file that makes the first line unparseable. Comments start with #. Paths are case-sensitive and must start with /.

Directive reference as parsed by Google and Bing
DirectiveMeaningNotes
User-agent: *Rules for all crawlers not matched by a more specific groupA crawler uses only the most specific matching group
Disallow: /pathDo not crawl URLs starting with /pathEmpty Disallow allows everything
Allow: /path/fileCrawl this even if a Disallow matchesLongest match wins; Allow wins ties in Google
Wildcards * and $* matches any sequence, $ anchors the endSupported by Google and Bing; not in the original standard
Sitemap: https://...Absolute URL of a sitemapCan appear multiple times, anywhere in the file
Crawl-delaySeconds between requestsIgnored by Google; honoured by Bing
04

Step three: test specific URLs against specific user agents

Syntax can be valid and still wrong. Pick ten URLs that must be crawlable, including your homepage, a product or article page, your sitemap, and your CSS and JS asset paths, plus five URLs that must be blocked. Test each against Googlebot, Bingbot, and the AI agents using a tester that implements the longest-match rule. SerionFlow's free robots.txt checker fetches the live file, parses it, and reports allow or block per URL and user agent; Google Search Console's robots.txt report shows the version Google last fetched and any parse errors.

Blocking CSS or JavaScript paths is a frequent silent failure: the page is crawlable but Google cannot render it, and rendering-dependent content is lost.

05

Step four: check the AI crawler groups

GPTBot (OpenAI), ClaudeBot (Anthropic), PerplexityBot, Google-Extended (Google's AI training control), and CCBot (Common Crawl) each honour their own User-agent group. A blanket Disallow for these ends any chance of citation in the corresponding assistants, which may or may not be what you intend. Decide deliberately, write explicit groups, and test them. Note that Google-Extended controls training use of your content, not Googlebot crawling, so blocking it does not remove you from AI Overviews. Some CDNs, including Cloudflare, can block AI crawlers at the edge regardless of robots.txt, so check that layer too.

  • Write explicit User-agent groups for each AI crawler you want to allow or block.
  • Test them with the same URL list you used for Googlebot.
  • Check CDN bot settings; edge blocks override robots.txt.
06

Mistakes that show up most often

Disallow: / left over from staging. A Sitemap line pointing at a relative path or a 404. Blocking /wp-content/ or /assets/ and starving the renderer. Using Disallow to hide pages that are already indexed, which freezes their stale snippet in place. Expecting robots.txt to apply across subdomains; each host needs its own file. And deploying a new file without re-testing, because the previous one was fine.

Step by step

  1. 01

    Fetch the file

    Request /robots.txt on every host and scheme you serve and confirm a 200 response with a text content type and no byte-order mark.

  2. 02

    Validate syntax

    Check that every rule sits under a User-agent line, paths start with a slash, wildcards are intentional, and Sitemap URLs are absolute and resolve.

  3. 03

    Build a URL test list

    Choose ten URLs that must be crawlable, including asset paths, and five that must be blocked, so the test covers both directions.

  4. 04

    Test per user agent

    Run the list against Googlebot, Bingbot, GPTBot, ClaudeBot, PerplexityBot, and Google-Extended with a tester that applies longest-match rules.

  5. 05

    Check the CDN layer

    Confirm that bot management or AI crawler blocking at the CDN is not overriding what robots.txt allows.

  6. 06

    Retest after every deploy

    Add the test to your release checklist and monitor the file for changes, since a single bad line can disallow the whole site.

Clear answers

Frequently asked questions

How do I test robots.txt online for free?

+

Use a tester that fetches your live file and evaluates a URL against a user agent. SerionFlow's free robots.txt checker does this without an account and reports allow or block per rule. Google Search Console's robots.txt report shows what Google last fetched and any parse errors it found.

Does robots.txt stop a page from being indexed?

+

No. It stops crawling, not indexing. A blocked URL can still be indexed from links and shown without a snippet. To keep a page out of search results, allow crawling and add a noindex meta tag or X-Robots-Tag header instead.

What happens if robots.txt returns a server error?

+

Google treats a 5xx or a timeout on robots.txt as a full disallow for the site until the file is reachable again, so crawling stops. A 404 is treated as allowing everything. Monitoring the file's availability is therefore as important as its contents.

Which rule wins when Allow and Disallow both match?

+

The rule with the longest matching path wins. If the lengths are equal, Google applies the Allow. Bing follows a similar longest-match approach. Testers that implement this correctly will show the winning rule for each URL.

Should I block AI crawlers in robots.txt?

+

Only if you have decided you do not want your content retrieved or cited by those assistants. Blocking GPTBot, ClaudeBot, or PerplexityBot ends citation in the corresponding products. Google-Extended controls AI training use and does not affect Googlebot or AI Overviews.

Continue exploring

Related SerionFlow resources

More in Guides

All guides

Make the next move obvious

Let SerionFlow turn your market evidence into momentum.

Confirm the market, rank the opportunities that matter, create brand matched pages on your domain, and keep moving with controlled weekly intelligence.

Choose how SerionFlow uses cookies.

Essential cookies keep the site secure and working. Product analytics helps us improve reliability. Optional cookies help us remember preferences and improve campaigns. You can change optional cookies anytime in Cookie Settings.