We use cookies to keep this site working and, with your permission, to remember your preferences, understand site traffic and support advertising. You can change your choice at any time. Cookie Policy

SEO Tool Orbit
Technical SEO

Robots.txt vs Meta Robots vs X-Robots-Tag

Robots.txt controls crawling; meta robots and X-Robots-Tag control indexing. Mixing them up is one of the most common ways sites accidentally disappear from search.

By SEO Tool OrbitUpdated November 9, 20265 min read

Illustration of a crawler choosing between an open route marked with a check and a blocked route marked with a red barrier
Crawling and indexing are controlled in different places. · Original illustration by SEO Tool Orbit

Three different mechanisms tell search engines what to do with your pages, and they look similar enough to be confused. They aren't interchangeable. One controls whether a crawler may fetch a URL; the other two control whether a page may appear in results. Using the wrong one can do the opposite of what you intended.

In short: use robots.txt to stop crawlers fetching areas they don't need, such as internal search results. Use a meta robots tag to keep an HTML page out of search results. Use the X-Robots-Tag HTTP header to do the same for PDFs, images and other files. Never block a page in robots.txt if you need search engines to see its noindex.

The three mechanisms at a glance

robots.txtMeta robotsX-Robots-Tag
ControlsCrawlingIndexing and snippetsIndexing and snippets
WhereOne file at the site rootIn the HTML <head>In the HTTP response headers
Applies toURL paths, by patternThe HTML page it's onAny file type
Typical useKeep crawlers out of low-value areasnoindex a thin or private pagenoindex PDFs or images; rules for whole folders
Crawler must fetch the page?No — that's the pointYes, or it never sees the tagYes, or it never sees the header

Robots.txt: controlling crawling

Robots.txt lives at /robots.txt on each host. It applies only to that host and protocol — https://www.example.com and https://example.com each need their own.

User-agent: *
Disallow: /search
Disallow: /cart
Allow: /search/help

Sitemap: https://example.com/sitemap.xml
  • User-agent names the crawler a group of rules applies to; * means all crawlers.
  • Disallow and Allow take path prefixes. Paths are case-sensitive.
  • Google and Bing support * as a wildcard and $ to match the end of a URL.
  • Sitemap points to your sitemap with an absolute URL — see the XML sitemap guide.

The key limitation: robots.txt prevents fetching, not indexing. If other pages link to a blocked URL, it can still appear in search results — just without a description, because the crawler never read the page.

The Robots.txt Generator builds a valid file with allow and disallow rules and a sitemap reference.

Meta robots: controlling indexing of HTML pages

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

Common values:

  • noindex — don't show this page in results.
  • nofollow — don't follow links on this page.
  • nosnippet — don't show a text snippet; max-snippet:[number] limits its length.
  • max-image-preview:large — allow large image previews.
  • unavailable_after: [date] — stop showing the page after a date.

You can target one crawler by name, for example <meta name="googlebot" content="noindex">. Check a page's robots tag, title and description with the Meta Tags Analyzer.

X-Robots-Tag: the same rules, as an HTTP header

PDFs, images and other files have no HTML <head>, so the rules go in the response header instead:

HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindex

Because it's set at the server, the header can also apply rules to a whole folder or file type in one place. See exactly which headers a URL returns with Get HTTP Headers. Our PDF SEO guide shows the header in use for documents.

When to use each

GoalUse
Keep a page out of search resultsnoindex (meta tag or header) — and let it be crawled
Stop crawlers wasting time on infinite filters or internal searchrobots.txt Disallow
Keep a PDF out of resultsX-Robots-Tag: noindex
Remove a page that should no longer existReturn 404 or 410, or redirect it
Keep private content privatePassword protection — none of these are security controls

Common mistakes

  • Blocking a noindexed page in robots.txt. The crawler can't fetch it, never sees the noindex, and the URL may stay indexed.
  • Leaving a staging rule live. Disallow: / or a site-wide noindex copied from staging to production.
  • Blocking CSS and JavaScript. Search engines need them to render pages properly.
  • Treating robots.txt as privacy. The file is public and lists exactly the paths you'd rather hide.
  • Expecting crawl-delay to work everywhere. Google ignores it; Bing and Yandex respect it.
  • Conflicting signals. A noindexed page that's also in your sitemap and set as a canonical target.

AI crawlers are controlled through robots.txt too. Blocking a training crawler is a business choice, but blocking the crawler behind an AI search product can remove you from its answers — our GEO guide discusses the trade-off.

Common scenarios and the right control

ScenarioRight controlWhy
Staging or test sitePassword protection (plus noindex as a backup)Robots rules aren't access control, and staging rules leak into production
Internal site search resultsrobots.txt Disallow, or noindexEndless low-value URL combinations
Faceted filters on a shopCanonical to the main category; Disallow only for crawl trapsSome filters deserve indexing; most combinations don't. Our e-commerce SEO guide covers the options
"Thank you" and confirmation pagesnoindexUseful to visitors, useless in search
Downloadable PDFs you don't want in resultsX-Robots-Tag: noindexPDFs have no HTML head
Printer-friendly duplicatesCanonical to the main pageThe content is a duplicate, not private

How robots blocking affects indexability

If a URL is disallowed, search engines can't read its content, its canonical tag or its noindex. They may index the bare URL anyway if it's linked, or drop it over time — you lose control either way. If a page should be indexed, it must be crawlable. If it shouldn't be, let it be crawled and say noindex. Canonical tags follow the same rule: a blocked page's canonical is invisible.

Testing changes safely

  1. Write the new rules and test specific URLs against them before publishing — Search Console's robots.txt report shows how Google fetched and read your file.
  2. Change one thing at a time, and keep a copy of the previous file.
  3. After publishing, check that important pages are still crawlable and that the file returns 200. A robots.txt that returns a server error can make Google pause crawling the site — one of the causes covered in our guide to pages Google isn't indexing.
  4. Crawl the site with an SEO Audit to catch pages that became blocked or noindexed by mistake.

Frequently asked questions

Does Disallow remove a page from Google?

No. It stops crawling. To remove a page from results, use noindex (and keep it crawlable), return 404/410, or use Search Console's removals tool for urgent cases.

Can I use noindex in robots.txt?

No. Google stopped supporting noindex rules in robots.txt in 2019. Use the meta tag or header.

Do I need a robots.txt file at all?

Not if you don't want to restrict crawling — a missing file means everything may be crawled. Most sites still add one to point to their sitemap.

Next step

Read your live robots.txt line by line, then check your three most important pages for a stray noindex with the Meta Tags Analyzer. Fix any conflict between the two before anything else.

Illustration of a structured hierarchy of URL cards branching from a single sitemap root

Technical SEO

How to Create an XML Sitemap for a Website

An XML sitemap tells search engines which pages you want found. Here's what to include, how to structure it for large sites, and how to keep it accurate.

5 min read