Your Top Questions About robots.txt, Answered
Wait, What Even Is robots.txt?
If you've ever peeked at a website's robots.txt file (just type any domain followed by /robots.txt into your browser), you've probably seen something that looks deceptively simple — a handful of lines like User-agent: * and Disallow: /admin/. But behind that simplicity lies one of the most misunderstood files in all of SEO.
Think of robots.txt as a set of house rules posted at your front door. Most well-behaved bots — Googlebot, Bingbot, and their friends — will read those rules and follow them. The key word there is most well-behaved. We'll get to that wrinkle in a moment.
Can robots.txt Stop Google From Indexing My Pages?
This is probably the single most common misconception in the field, and it causes real damage to real websites. The short answer: no, robots.txt does not prevent indexing. It only prevents crawling.
Here's the distinction that matters:
- Crawling means Googlebot visits the page and reads its content.
- Indexing means Google stores the page in its index so it can appear in search results.
Google can index a page it has never crawled — if other pages link to it, Google knows the URL exists and can add it to the index with no content snippet. You might even have seen this in Search Console: pages marked as "Submitted URL blocked by robots.txt" that are somehow still appearing in search. That's exactly this problem playing out in practice.
If you want a page out of Google's index, you need a noindex directive delivered via the page's HTTP response header or a <meta name="robots" content="noindex"> tag in the HTML head — and critically, Googlebot has to be able to crawl the page to actually see and respect that tag. Block crawling via robots.txt and the noindex tag becomes invisible to the bot.
So What Should I Actually Use robots.txt For?
Great question. robots.txt shines when you want to manage crawl budget — the finite amount of time Googlebot spends on your site before moving on. For large sites, that budget matters a lot. Here are legitimate use cases:
- Blocking faceted search URLs that create thousands of near-duplicate pages (e.g.,
/products?color=red&size=M&sort=price) - Keeping internal search result pages out of Googlebot's queue
- Preventing crawling of staging environments (though password protection is better)
- Blocking non-essential assets like JavaScript or CSS files from specific bots that don't need them
- Stopping image-scraping bots from hammering your media files
What you should not use it for: hiding private content, blocking pages you want deindexed, or protecting sensitive data. robots.txt is a public file — literally anyone can read your disallow rules, which can inadvertently tell curious people exactly where your interesting private directories live.
What's the Difference Between Disallow and Noindex in robots.txt?
This trips up even seasoned SEOs. Let's break it down clearly:
- Disallow (in robots.txt): Tells crawlers not to visit a specific URL or directory. It's a crawling instruction, not an indexing one.
- Noindex (as a robots.txt rule): There used to be a
Noindex:directive that some bots supported inside robots.txt, but Google officially stopped supporting it in September 2019. If you still have lines likeNoindex: /page/in your robots.txt, they are doing absolutely nothing for Google.
The proper way to noindex a page is the meta robots tag or X-Robots-Tag HTTP header — both require the page to remain crawlable. This is a point worth repeating because the mistake of blocking crawling and expecting deindexing is surprisingly persistent, even on sites managed by experienced teams.
Does robots.txt Work on All Bots?
Only on bots that choose to follow the Robots Exclusion Protocol. Major search engines like Google, Bing, DuckDuckGo, and Yandex respect it. But:
- Malicious bots ignore it entirely. If you're trying to block scrapers or spam bots with robots.txt, don't bother — they won't read it.
- Some AI training crawlers have a mixed track record. You'll want to check each crawler's documentation and potentially use dedicated user-agent rules.
- Archive.org's Wayback Machine respects robots.txt retroactively now, but historical snapshots may already exist.
For blocking bad actors, you need firewall rules, rate limiting, or tools like Cloudflare Bot Management. robots.txt is not a security tool.
Can I Put My Sitemap URL in robots.txt?
Yes, and it's actually a recommended practice. You can add a line like this anywhere in your robots.txt file:
Sitemap: https://www.yoursite.com/sitemap.xml
This helps crawlers discover your sitemap even if they haven't been told about it through Search Console or Bing Webmaster Tools. You can include multiple sitemap entries if you have separate sitemaps for different content types — images, videos, news, etc.
One thing to watch: the URL in the Sitemap directive must be absolute (including the https://), not relative. A surprising number of robots.txt files get this wrong and end up with a sitemap line that points nowhere useful.
What Happens If I Have Conflicting Rules in robots.txt?
Good question, and the answer varies by bot. For Googlebot specifically, the rule is: the most specific matching rule wins. Consider this example:
Disallow: /blog/Allow: /blog/featured/
Googlebot will crawl /blog/featured/ but not the rest of the blog directory, because the Allow rule is more specific. Bing and other crawlers may interpret conflicting rules differently — some use a "last rule wins" approach. If you're trying to fine-tune access for multiple search engines, test your rules using each engine's respective URL testing tools.
One particularly nasty conflict to avoid: a site-wide Disallow: / under a wildcard user-agent combined with an Allow rule for a specific bot. Double-check your logic before deploying, because a stray / in the wrong place has deindexed entire domains before.
How Do I Test My robots.txt Before Going Live?
Google Search Console has a robots.txt Tester under the Legacy Tools section (though it's been in and out of the interface — check the current UI). You paste in a URL and it tells you whether Googlebot would crawl it based on your current robots.txt.
For more thorough testing:
- Use Screaming Frog's robots.txt checker to simulate crawls against your rules in bulk
- Try Google's robots.txt Tester for quick spot-checks
- Run a crawl audit on a staging version of your site before launching major rule changes
- Check your server logs after deploying changes to confirm bots are behaving as expected
The logs check is underrated. If Googlebot is still hitting URLs you thought you'd blocked, the logs will tell you — and that's an immediate sign something in your rules isn't working as intended.
Should Every Website Have a robots.txt File?
Not strictly necessary, but it's considered good hygiene. If a crawler hits /robots.txt and gets a 404, most bots treat it as "no restrictions" and crawl freely — which is usually fine for small sites. But even a minimal robots.txt that just lists your sitemap URL adds value without any downside.
For larger sites, e-commerce platforms, or any site with staging environments and internal tools, a well-maintained robots.txt is not optional — it's part of your technical SEO foundation. The risks of leaving crawl behavior entirely to chance grow proportionally with site complexity.
One Last Thing: robots.txt Is Not Static
A lot of teams set up robots.txt during initial site launch and never touch it again. That's a mistake. As your site grows — new directories, new features, new URL structures — your robots.txt needs to grow with it. A quarterly review isn't overkill. Check whether your disallow rules are still accurate, whether any important pages are accidentally blocked, and whether newly added sections of the site need their own crawl instructions.
Small file, outsized consequences. Treat it accordingly.