Robots.txt (robots exclusion protocol). What it means.

Robots.txt is a plain text file at the root of a website that tells search engine crawlers which URLs they may and may not fetch. It controls crawling, not indexing.

By Brady Heinrich · Updated

Definition

Robots.txt is a plain text file at the root of a website that tells search engine crawlers which URLs they may and may not fetch. It controls crawling, not indexing.

What is robots.txt?

A robots.txt file is a set of instructions for crawlers, placed at the top level of a site, for example at example.com/robots.txt. Before fetching pages, well-behaved bots read it to see which paths are off limits to them.

Google's documentation is explicit about its purpose: it is used mainly to avoid overloading a site with requests, and it is not a mechanism for keeping a web page out of Google.

How does robots.txt work?

The file is made of groups. Each group names a crawler and lists rules for it.

LineMeaning
User-agent: *The rules below apply to every crawler
Disallow: /admin/Do not fetch any URL starting with /admin/
Allow: /admin/help/An exception to the rule above
Sitemap: https://example.com/sitemap.xmlWhere the sitemap is

A group with an empty Disallow line allows everything. "Disallow: /" blocks the entire site for that crawler.

Robots.txt example

A typical small-site file has four lines: a User-agent line with an asterisk, a Disallow line for the admin or internal search path, an Allow line if an exception is needed, and a Sitemap line. Most sites need nothing more.

Does robots.txt disallow stop a page being indexed?

No. Disallow stops crawling. Google warns that a disallowed URL can still be indexed if other pages link to it, and may then appear in results as a bare address without a description. To keep a page out of search, Google says to use a noindex rule or password protection.

The two do not combine. If a page is blocked in robots.txt, the crawler never fetches it, so it never sees a noindex tag on that page.

GoalUse
Stop bots wasting requests on unimportant URLsrobots.txt Disallow
Keep a page out of search resultsnoindex, with crawling allowed
Keep content privateA login

What are the limits of robots.txt?

  • It is a request, not an enforcement. Google notes that reputable crawlers obey it and others may not.
  • Crawlers can interpret syntax differently.
  • The file is public, so it is no place to list secret paths.
  • Blocking scripts or style files that a page needs can stop Google understanding the page.

Robots.txt and AI crawlers

AI companies publish the user-agent names of their crawlers, and the same file is where a site allows or disallows them. The decision is commercial: blocking a crawler used to fetch pages for AI answers also removes the chance of being cited in them.

An example

A staging rule, "Disallow: /", is left in robots.txt when a redesigned site goes live. Over the following weeks pages drop out of Google's results or show with no description. Deleting that one line and requesting a recrawl in Search Console starts the recovery.

The common mistake

Using Disallow to hide a page from search. The URL can still be indexed from links elsewhere, and because the crawler is blocked it cannot see a noindex tag. Allow crawling and use noindex instead.

How people search for robots.txt

  • robots.txt6,600 a month
  • robots txt6,600 a month
  • what is robots.txt880 a month
  • robots.txt example390 a month
  • robots.txt disallow320 a month

US monthly searches, Google Ads keyword data.

Related terms

Go deeper

Building something ambitious? Let's talk.

We reply within one business day.