What is robots.txt?

SEO glossary · Technical SEO

Short answer

Robots.txt is a plain text file at the root of a site that tells crawlers which URLs not to fetch. It controls crawling, not indexing, so it cannot keep a page out of Google. Almost every robots.txt problem I find comes from someone asking it to do that second job.

Every site can have one, at exactly one address: yourdomain.com/robots.txt. Crawlers that respect it, Googlebot included, read it before requesting anything else and skip whatever it disallows. A minimal file looks like this:

User-agent: *
Disallow: /cart
Sitemap: https://example.com/sitemap.xml

That says: any crawler, do not fetch anything under /cart, and here is where the sitemap lives.

What it is actually for

Google’s introduction to robots.txt describes it as a way to manage crawler traffic, mainly so crawlers do not overload your server or waste time on URLs that do not matter. That is the whole job. Good uses are narrow: endless calendar or filter URLs, internal search, cart and checkout paths, and admin areas.

The same page says, in as many words, that robots.txt is not a mechanism for keeping a page out of Google. A blocked URL can still be indexed if other pages link to it. It just appears without a description, because Google was never allowed to read the page. Search Console even has a status for this: “Indexed, though blocked by robots.txt”. I cover what that status means and how to fix it in indexed though blocked.

Where I see it go wrong

Blocking pages to get them out of the index. It does not remove them, and it stops Google seeing any noindex you add. If you want a page out of search, allow it to be crawled and put a noindex on it.

Blocking CSS and JavaScript. Older advice said to keep crawlers out of theme and script folders. Google renders pages much like a browser now, and if it cannot load the files that build the page, it may misread the layout or miss content entirely. Google’s own guidance warns against blocking resources a page needs to be understood.

A staging file that went live. A development site is often protected with Disallow: /. When the site launches and the file comes with it, the whole site is blocked. This one gets noticed fast, because traffic falls within days, but the recovery takes weeks.

Rules that are broader than intended. Disallow rules match by prefix. Disallow: /services blocks /services, but also /services-area-map and /services/roof-repair. One missing slash can block a section you meant to keep.

Using it for crawl-delay. Google ignores the Crawl-delay line. If Googlebot is genuinely straining your server, the fix is on the server side, not in robots.txt.

The longer list, with the fixes, is in the robots.txt mistakes I find in audits.

How to check yours

  1. Open it in a browser. Go to yourdomain.com/robots.txt and read every line. Each Disallow should cover something you would be happy never to see in Google.
  2. Test your important URLs against it. Search Console’s robots.txt report shows the version Google fetched and when. URL Inspection tells you whether a specific URL is blocked.
  3. Look for blocked theme, plugin or script folders. If any appear, run URL Inspection’s live test on a page and check whether the rendered screenshot looks right.
  4. Check the page indexing report for “Indexed, though blocked”. Any URL in that list is one you blocked and Google indexed anyway. Decide whether it should be in Google, then either unblock and noindex it, or unblock it and let it rank.

When it does not matter

For a typical small business site, an empty or missing robots.txt is fine. A missing file means everything may be crawled, which is usually what you want. The HTTP Archive’s 2025 Web Almanac found robots.txt requests returning a 404 on 13% of sites, and that by itself costs them nothing.

It is worth more thought on large stores with filters, on sites that generate their own URLs, and now on the question of AI crawlers. The same Almanac found GPTBot named in 4.2% of robots.txt files and ClaudeBot in 3.4%. Whether to allow those is a business decision, not a ranking one, and I go through it in AI crawlers and robots.txt.

Questions people ask about robots.txt

Does every site need a robots.txt file?

No. Without one, crawlers assume they may fetch everything, which is the right setting for most small sites. A file is worth having to point at your sitemap and to keep crawlers out of genuinely useless sections, such as internal search or cart pages.

Can robots.txt stop people seeing a page?

No. It is a public request to well-behaved crawlers, not a lock. Anyone can open the file, and listing a private folder in it advertises where that folder is. Anything private belongs behind a login.

How quickly does Google see changes to robots.txt?

Google generally caches the file for up to a day before fetching it again. Search Console’s robots.txt report shows the last version Google fetched, and lets you ask for a recrawl after an urgent fix.

What does “Disallow: /” mean?

It blocks the entire site for whichever crawler the rule names, or for all crawlers if it sits under User-agent: *. That is correct on a staging copy and catastrophic on a live site, which is why it is the first line I look for whenever traffic drops right after a launch.

A robots.txt rule can quietly block a whole section, so it is one of the first files my technical SEO audits read.

Related terms

Back to the SEO glossary.