How to Test a robots.txt File: Is This URL Allowed?

Test whether a robots.txt file allows or blocks a URL for Googlebot or any crawler, see which rule matched, and understand longest-match precedence and wildcards.

By Alok Singh (@aloksinghdev.bsky.social)
Published:

Originally published at https://bestlatestapps.com/blog/how-to-test-a-robots-txt-file-is-this-url-allowed/.

A single misplaced Disallow: / has de-indexed entire sites. More commonly, a rule meant to block /admin also blocks /administration-guide, the most useful page on the site. Robots.txt tester tells you, for a given crawler and URL, whether it's allowed or blocked and exactly which line decided it.

Steps

You get "allowed" or "blocked" plus the rule that matched.

The page doesn't fetch the live file. You paste what you want tested, which is actually useful: you can test a draft before deploying it.

How the winner is chosen

This is where intuition fails, so it's worth knowing the logic:

So with:

User-agent: *
Disallow: /private
Allow: /private/ok

/private/ok is allowed (longer Allow beats shorter Disallow), and /private/secret is blocked.

Wildcards

Disallow: /*.pdf$ blocks URLs ending in .pdf, but not /file.pdf?download=1, because that doesn't end in .pdf.

Lines after # are comments and ignored.

Common mistakes

Example: launching a new section

You're adding /blog/drafts/ that shouldn't be crawled, while /blog/ must stay open. Add Disallow: /blog/drafts/, then test /blog/my-post/ (should be allowed), /blog/drafts/x/ (blocked) and /blog/drafts-and-ideas/ (allowed, thanks to the trailing slash). Three checks, and you're confident before deploying.

Limits

It applies the rules in the box. It doesn't ask Google, and the live index can differ, for instance if Google cached an older robots.txt. Use Search Console's tools for what Google has actually seen.

A pre-deploy checklist

Keep a short list of URLs that must always be crawlable (home page, key category pages, a top product, the sitemap) and a few that must always be blocked (admin, cart, internal search results). Before shipping any robots.txt change, paste the new file and run each URL through the tester. It takes two minutes and catches the accidental block before Google does. Rerun the same list after a CMS or hosting migration, when robots.txt files often get silently replaced.

Privacy

The tool page says the file and URL stay in the tab and aren't uploaded. Google ads run on the page, as across the site.

FAQ

Why is /private/ok allowed when /private is blocked? The longer Allow pattern wins.

Does it check with Google? No, it applies the rules you pasted.

Does Disallow: / block everything? Yes, for that group, unless a longer Allow matches.

Which crawler should I test? The one you care about, usually Googlebot.

Before the next robots.txt change goes live, test it with Robots.txt tester.

— Alok Kumar Singh