Short answer: robots.txt is a plain text file at the root of your site that tells crawlers which paths they may fetch. Use it to keep crawlers out of admin and duplicate areas and to list your sitemap. It does not hide pages from search results; use a noindex tag for that.
A simple example
User-agent: *
Disallow: /admin/
Disallow: /cart/
Sitemap: https://yourdomain.com/sitemap.xml
In robots.txt, each Disallow line blocks a path, and the Sitemap line tells crawlers where your sitemap is. See XML sitemaps.
Common mistakes
- Disallow: / left over from a staging site, which blocks everything.
- Blocking CSS and JavaScript, so search engines can't render the page properly.
- Using robots.txt to hide private pages. The file is public, and blocked pages can still appear in results if linked elsewhere.
- Forgetting the sitemap line.
robots.txt vs noindex
| Goal | Use |
|---|---|
| Stop crawling of a section | robots.txt Disallow |
| Keep a page out of search results | noindex meta tag (page must stay crawlable) |
| Truly private content | A password, not either of the above |
How to check yours
Visit yourdomain.com/robots.txt and use the robots.txt report in Google Search Console.
Frequently asked questions
Do all bots obey robots.txt?
Reputable crawlers do. Malicious bots ignore it, so it isn't a security tool.
Should I block AI crawlers?
That's a business choice. Blocking them may reduce how often AI tools can read and cite your site.



