robots.txt, noindex and the tags that control search

robots.txt controls crawling and noindex controls indexing. How each works, how they interact, what real sites do, and the mistakes that hide a whole site.

BeginnerHow-to7 min readUpdated October 30, 2026

In this guide
  1. Two controls, two jobs
  2. robots.txt
    1. What MDN says not to do
    2. What the file's status code means
    3. What real files look like
  3. noindex
    1. To remove a page from results
    2. How common each is
  4. Which to use
  5. The speed angle
  6. Mistakes that hide a site
  7. How to check
  8. Check your own page
  9. Sources

Two controls, two jobs

The 2025 Web Almanac states the split plainly. Robots directives influence indexing and serving: whether a page can appear in results and how. The robots.txt file governs crawling: whether a bot may fetch a URL at all. For a directive on a page to take effect, the crawler must be able to reach the page, so a page blocked in robots.txt may never have its directives seen.

A crawler that is not allowed to fetch a page cannot read a noindex on it. MDN says the same: if a resource is blocked from crawling through robots.txt, any indexing rules in a robots tag or X-Robots-Tag header will not be detected and will be ignored. MDN also notes that a page blocked from crawling may still be indexed if other documents refer to it.

Neither control is enforced. MDN stresses that only cooperative robots follow these rules, and that they do not stop bad actors such as email harvesters.

robots.txt

robots.txt is a text file placed in the root of a website, for example https://www.example.com/robots.txt. MDN describes it as saying whether crawlers may access the whole site, or specified resources. A restrictive file can also prevent bandwidth being used by crawlers.

The simplest examples from MDN:

# Keep every crawler out of the whole site
User-agent: *
Disallow: /

This is what a staging site might have, and what a live site must never have. A file with no rules at all lets crawlers in.

What MDN says not to do

MDN's implementation guide says to use the file to reduce site load and to stop unsuitable content appearing in search results, and that it should not be used to hide private information. The file is publicly readable. Listing a sensitive path in it shows that path to anyone who looks, including attackers. Some robots, such as malware robots, ignore the file. Protect private pages with a login, not with a rule in this file.

What the file's status code means

The 2025 Web Almanac, which checked the files of a very large number of sites, adds some detail about how crawlers treat the file itself:

The RFC the Almanac refers to is the Robots Exclusion Protocol, standardized by the IETF as RFC 9309.

What real files look like

The catch-all rule for *, meaning every crawler, appeared in 77% of the files. Rules for named crawlers are rarer. The Almanac found that rules naming AI crawlers grew fast in a year. GPTBot was named in about 4% of files, ClaudeBot in about 3.5%, and others in a similar range. The Almanac's reading is that robots.txt now has two jobs: managing visibility in search, and deciding whether content may be used to train AI models. Those are separate decisions, and the file lets you answer each.

Crawlers also differ in how they read *. The Almanac notes that Google's AdsBot ignores it, and that another crawler falls back to Googlebot's rules before applying it, so some bots need to be named.

noindex

There are two ways to ask that a page stay out of search results.

A robots meta tag, in the page's head:

<meta name="robots" content="noindex">

An `X-Robots-Tag` header, in the HTTP response:

X-Robots-Tag: noindex

The header works for files that have no HTML, such as PDFs and images. MDN calls it a de-facto standard, not part of any specification.

Both take comma-separated rules. MDN lists the common ones: index and follow are the defaults, noindex asks the robot not to index the page, nofollow asks it not to follow the links on it, and none equals noindex, nofollow. There are also rules for the preview shown in results, such as nosnippet, max-snippet and max-image-preview. Conflicting values, such as index with noindex, have undefined behavior.

To remove a page from results

MDN's advice: X-Robots-Tag: noindex will typically work, but a robot must first revisit the page to see it. So the page has to be crawlable. Do not block it in robots.txt at the same time. If the page should disappear for good, removing it so the address returns an error, or redirecting it, is another route. See redirects and status codes.

How common each is

The Almanac found a robots meta tag on 47% of pages, while the header was on under 1%. Both were present at once on 0.4% of pages, which it does not recommend, since two methods raise the chance of conflicting signals. The rules index and follow are unnecessary, because they are the defaults, yet they appeared on about 60% of pages. The Almanac suggests a popular SEO plugin that outputs them by default as a likely reason.

Which to use

You want toUse
Keep crawlers away from paths with no search value, or cut the load they causerobots.txt
Keep a page out of search resultsnoindex, with crawling allowed
Keep a PDF or image out of resultsX-Robots-Tag: noindex
Keep a page privateA login or a password, not a robots rule
Hide a staging siteA password, plus a block while you work
Point duplicates to one versionA canonical link. See canonical tags

The speed angle

Crawlers are visitors. They make requests to your server, and some are heavy. MDN notes that a restrictive robots.txt can reduce bandwidth use, and the Almanac observes that SEO tools can generate significant crawl activity, which is why so many sites name those tools in the file. A slow server also affects crawlers. See server response time.

Mistakes that hide a site

How to check

  1. Open `/robots.txt` on your site and read it. Check that the status is 200 and the rules are what you meant.
  2. View the page source for a robots meta tag, and look at the response headers for X-Robots-Tag in the Network panel. See the Network panel.
  3. Run Lighthouse. Its Page is blocked from indexing audit fails when a header or tag blocks all crawlers, and the robots.txt is valid audit checks the file. In Lighthouse 13.5 the first of these carries by far the largest weight among the SEO checks. It does not fail for crawler-specific rules, such as one aimed at Googlebot, though it may warn.
  4. After a change, allow time for crawlers to come back.

Check your own page

Run the free audit and read the SEO findings. Then open your robots.txt and your home page's source. Confirm that you are not blocking anything you want found, and not leaving anything open that you want private.

Sources

Start here

Free website audit

Live Google data for any public page: mobile and desktop.

Mobile + desktop · Lighthouse lab test · Real-user Chrome data when Google has it

Rather have this done for you? Technical SEO · Book a call

Related guides

All guides →