In this guide

What robots.txt is

Robots.txt is a text file at the domain root, at example.com/robots.txt, that tells crawlers which paths on the site they may access. The format follows the Robots Exclusion Protocol, published as an IETF standards-track document in RFC 9309 in September 2022. The RFC itself notes that the rules are not a form of access authorization: legitimate crawlers follow them, but nothing stops others from ignoring them.

According to Google's introduction to robots.txt, the file is used mainly to avoid overloading a site with requests. It is not a mechanism for keeping a page out of Google.

A mistake in this file can remove whole sections from search without any visible warning on the site. That is why it is one of the first things we check in our SEO service for businesses.

How to write the rules

Google supports four fields: user-agent, allow, disallow, and sitemap. Fields such as crawl-delay are not supported. A typical file for a business website:

User-agent: *
Disallow: /admin/
Disallow: /search
Allow: /admin/public-help/

Sitemap: https://example.com/sitemap.xml

A few rules from Google's specification that prevent surprises:

  • Location: the file must be in the top-level directory. A copy in a subfolder is not valid.
  • Size: Google reads up to 500 KiB. Anything beyond that is ignored.
  • Case: paths are case-sensitive.
  • Wildcards: * stands for any sequence of characters and $ marks the end of the URL. Disallow: /*.pdf$ blocks any URL ending in .pdf.
  • Conflicts: the most specific rule, the one with the longest path, wins. In a tie, Google applies the least restrictive rule.
  • Sitemap: the Sitemap: line takes the full file URL and can appear anywhere in the file.

Robots.txt and noindex

This is the most costly confusion. Robots.txt controls crawling: whether the crawler can read the page. Noindex controls indexing: whether the page can appear in results.

When a URL is blocked in robots.txt, Google does not read its content. But if other pages point to that URL, Google can still index it without visiting it, and it appears in search without a description.

The reverse fails too. Google warns on its noindex page that the rule only works if the page is not blocked by robots.txt. If it is, the crawler never sees the noindex, and the page can stay in results.

To remove a page from search, the order is: allow crawling, apply noindex, and wait for Google to read the page again.

Mistakes that cost traffic

  • Disallow: / left in production: a staging rule blocks the whole site after launch.
  • Blocked CSS and JavaScript: Google needs these files to render the page. Its guidance is to block resources only when the page loaded without them is not significantly affected.
  • Using Disallow to remove pages from search: the URL can stay indexed without a description, and noindex can no longer be read.
  • Wrong path spelling: /Admin/ and /admin/ are different paths.
  • A file returning server errors: with a 5xx error, Google stops crawling the site for the first 12 hours and then uses the last cached version for up to 30 days.

How to check the file

  1. Open the address in a browser and confirm the published file is the expected one, without staging rules.
  2. Use the Search Console robots.txt report to see the version Google last read and whether there were fetch errors. It replaced the old robots.txt Tester: when it launched the report in November 2023, Google itself announced it was sunsetting the Tester, as reported by Search Engine Land and Search Engine Roundtable, which quotes Google's post. Tutorials that still point to the Tester are out of date.
  3. Test important pages with Search Console's URL Inspection tool, which shows whether crawling is blocked by robots.txt.
  4. After a change, request a recrawl of the file in the same report. Otherwise Google may take up to 24 hours to read the new version.

If you want to control AI crawlers such as GPTBot and ClaudeBot, each has its own name and rules. The step-by-step is in our guide to robots.txt for AI crawlers.

How ROMA applies this

In ROMA's SEO method, the robots.txt review is part of step 1, the Opportunity Assessment, because a wrong block can explain a lack of traffic on its own. The fix belongs to step 3, Foundation & Core Architecture, together with the sitemap, canonicals, and noindex, so all four send the same signal about each URL. After any change, the Search Console robots.txt report becomes part of the step 5 review.

Robots.txt FAQ

Does blocking a page in robots.txt remove it from Google?

Not necessarily. Google explains that a blocked URL can still be indexed if other pages point to it, and it then appears without a description. To remove a page from search, use noindex and keep the page accessible to the crawler.

Does Google support crawl-delay?

No. Google supports only the user-agent, allow, disallow, and sitemap fields. Other fields, such as crawl-delay, are ignored.

Is robots.txt case-sensitive?

Path values are. Disallow: /Admin/ does not block /admin/. Field names such as User-agent and Disallow are not case-sensitive.

What happens if robots.txt returns an error?

It depends on the error. For 404 or other 4xx errors, except 429, Google acts as if there were no restrictions. For 5xx server errors, Google stops crawling the site for the first 12 hours and then uses the last version it could read.

How long does Google take to read a new robots.txt?

Google generally caches the file for up to 24 hours. To speed this up, use the request a recrawl option in the Search Console robots.txt report.

Sources