What is Robots.txt
A root-level file that tells crawlers which URLs they may or may not fetch.
Overview
Robots.txt is a plain-text file at the root of a domain that gives crawling instructions to bots via allow and disallow rules. It controls what search engines are permitted to crawl, and it is the first file most crawlers request. It is a crawling directive, not an indexing one.
A critical distinction: disallowing a URL stops Google fetching its content, but the URL can still be indexed (without a snippet) if it is linked from elsewhere. To keep a page out of the index, use a noindex tag, which requires the page to be crawlable.
Common mistakes
Using robots.txt to try to hide a page from search (use noindex instead), blocking CSS or JS that Google needs to render the page, or leaving a staging Disallow: / rule live after go-live.
- Do not block resources needed for rendering
- Do not rely on it to deindex pages
- Reference your sitemap with a Sitemap: line
Why it matters
robots.txt is the first file Googlebot requests on any site, and a single wrong line can be catastrophic — a stray `Disallow: /` pushed to production has taken major sites out of Google entirely. It is a crawl-control tool, not an index-control tool, and confusing the two is the most common and damaging mistake. Used well, it conserves crawl budget and keeps bots out of admin, search-result and infinite URL spaces; used carelessly, it silently blocks the pages you most want ranked.
- The first file every crawler checks — errors here affect the whole site
- Controls crawling, not indexing — a blocked URL can still appear in results
- A wrong Disallow can de-rank an entire site, so it needs careful review
Common mistakes and the noindex trap
The classic error is using robots.txt to try to remove a page from Google. Because a disallowed page is never crawled, Google never sees a noindex tag on it — so a page you block in robots.txt AND noindex can stay indexed indefinitely, since the crawler can never read the noindex. To reliably de-index a page you must allow it to be crawled and serve a noindex (or use the removals tool). Also remember robots.txt is public: never rely on it to hide sensitive URLs, since you are literally publishing their paths.
- To de-index a page, do NOT block it in robots.txt — it must be crawlable to read the noindex
- Blocking CSS/JS can break rendering and hurt how Google sees the page
- robots.txt is publicly readable — never use it as a security measure
In practice
A SaaS company launches a redesign and organic traffic collapses overnight. The cause is a single line — `Disallow: /` — carried over from the staging robots.txt and pushed live, blocking Googlebot from the entire site. Because the pages were still indexed but now uncrawlable, they began dropping out of results as Google refreshed. The immediate fix is to correct robots.txt to allow crawling, then use URL Inspection to request re-crawling of key pages. The broader lesson: robots.txt is the highest-blast-radius file on a site, so it belongs in code review and deploy checks, staging and production versions must never be confused, and after any deploy the live robots.txt should be verified in Search Console's robots.txt report before you move on.
Related defined terms
Part of our defined terms knowledge graph — browse every entry in this branch.
Crawl Budget
SEO ConceptHow many pages a search engine will crawl on your site, and how often.
Indexation
Technical SEOWhether a page is stored in a search engine’s index and eligible to rank.
XML Sitemap
Technical SEOA machine-readable list of your important URLs, submitted to help discovery.
Search Intent
SEO ConceptThe underlying goal behind a search query, which content must satisfy to rank.
SERP
SEO ConceptThe Search Engine Results Page — everything a search engine returns for a query.
Common questions
Robots.txt — questions
Straight answers on how this fits your marketing and build.
Can robots.txt remove a page from Google?
Should I block my CSS and JavaScript?
Does robots.txt stop a page appearing in Google?
Should I block my staging site with robots.txt?
Still have questions? Talk to a specialist