Should you use robots.txt or noindex to hide a page?
By TechCompare · Updated · How we check
To keep a page out of Google, let Googlebot fetch it and add noindex. Blocking it in robots.txt can leave the URL in the results, since Googlebot never reads the noindex.
They do different jobs. A robots.txt rule asks crawlers not to fetch a URL. A noindex rule asks search engines not to show the page in results. The trap is using both on one page. If robots.txt blocks the page, the crawler never sees the noindex.
How it works
Google's documentation says that if a page is blocked by robots.txt, the crawler will never see the noindex rule, and that the page can still appear in search results, for example because other pages link to it. For noindex to work, the page must not be blocked. Noindex goes in a meta tag in the page, or in an X-Robots-Tag HTTP header, which Google recommends for files that aren't HTML, like PDFs, video and images. Robots.txt fits a different goal: saving crawl effort on sections that don't need crawling, like endless filter pages. Neither one is security. RFC 9309 says the protocol isn't a substitute for valid content security measures, and listing a path in robots.txt makes it public. This tester reads robots.txt rules only. It doesn't look at meta tags or headers, so a page it shows as allowed can still carry a noindex.
Verdict
Keep Disallow off any page that carries noindex, or the noindex does nothing. If a URL is blocked and still shows up in results, remove the Disallow so the crawler can fetch the page and read the tag. For private content, use a login.
More Robots.txt scenarios
Frequently asked questions
Can a page blocked in robots.txt still appear in Google?
Does noindex work inside robots.txt?
How do I keep a PDF out of search?
Related tools
Open Graph Visualizer
Preview how your website links will look when shared on Google, Twitter, Facebook, and Discord.
Use toolSSL Checker
Check a site's certificate, TLS versions, HTTP/2 and HTTP/3 support, post-quantum key exchange, HSTS and redirects, or compare two sites.
Use toolDNS Lookup
Look up a domain's DNS records on Cloudflare or compare several resolvers at once, and read its SPF, DMARC and DKIM records in plain words.
Use tool