The X-Robots-Tag is an HTTP response header that passes indexing and serving rules for a URL to search engines. It carries the same rules as the robots meta tag and also works for files without HTML, such as PDFs, images and videos.
When is it useful?
A robots meta tag belongs in the <head> of an HTML page. A PDF or an image has no such section, so the rule goes into the response header. Google says any rule usable in a robots meta tag can also be set as an X-Robots-Tag, for example noindex, nofollow, nosnippet, max-snippet, noimageindex and unavailable_after.
A rule can be addressed to one crawler by putting its user agent token in front. Rules without one apply to all crawlers. If rules conflict, the more restrictive one applies, according to Google and MDN. MDN describes the header as a de-facto standard that is not part of a specification.
Because the header is part of the HTTP response, it can be set globally in server configuration for whole file types.
| Method | Prevents crawling? | Keeps the URL out of Search? | What Google says | Typical use |
|---|---|---|---|---|
robots.txt Disallow | yes | no, the URL can be indexed without its content if other pages link to it | used mainly to avoid overloading the server with requests; not a mechanism for keeping a page out of Google | Limiting crawler load, excluding areas from being fetched |
noindex in the robots meta tag | no, Google has to be able to fetch the page | yes | only works if the page isn't blocked by robots.txt; Google then drops the page even if other sites link to it | HTML pages that stay reachable but shouldn't show up in search results |
noindex in the X-Robots-Tag HTTP header (this term) | no, Google has to be able to fetch the URL | yes | any robots meta tag rule can also be sent as a header; same prerequisite as the meta tag | Files without an HTML head, such as PDFs, images or videos |
rel="canonical" | no | not directly; a strong signal for which of several duplicate URLs becomes canonical | helps consolidate signals such as links into the preferred URL; don't use robots.txt or noindex for canonicalization | Duplicate and very similar pages, for example from parameters |
| Status code 410 (or 404) | no, but Google gradually fetches the URL less often | yes, a previously indexed URL is removed | treats 404 and 410 the same way | Page permanently removed with no replacement |
| Password protection (login) | yes, crawlers can't reach the content | yes | one of the ways Google lists for permanent removal; authorised users see the page, crawlers don't | Private or confidential content |
| Search Console: Removals | no, Google can keep crawling the URL | hides the URL from search results for about six months | temporary only; 404/410, password protection or noindex make it permanent | Urgent cases, until a permanent measure takes effect |
robots.txt and noindex cancel each other out. If a URL is blocked by robots.txt, Google never sees the noindex, and the URL can still appear in results. Google doesn't support noindex inside the robots.txt file itself. Sources: Google Search Central: Introduction to robots.txt (last updated 2025-12-10); Google Search Central: Block Search indexing with noindex (last updated 2025-12-10); Google Search Central: Robots meta tag, data-nosnippet, and X-Robots-Tag specifications (last updated 2026-03-24); Google Search Central: How to specify a canonical URL (last updated 2026-07-10); Google Crawling Infrastructure: How HTTP status codes affect Google's crawlers (last updated 2026-02-04); Google Search Central: Remove information from Google (last updated 2025-12-10); Search Console Help: Removals and SafeSearch reports tool. Last checked: .
Example
HTTP/1.1 200 OK
X-Robots-Tag: noindex
X-Robots-Tag: googlebot: nofollow
Apache configuration from Google’s documentation for all PDF files:
<Files ~ "\.pdf$">
Header set X-Robots-Tag "noindex, nofollow"
</Files>
Common mistakes
The crawler must be able to fetch the URL to see the header. Google writes that if robots.txt disallows a URL, indexing and serving rules on it are not found and therefore ignored. According to Google, a page blocked by robots.txt can still be indexed if other sites link to it.
Sources
- Robots meta tag, data-nosnippet, and X-Robots-Tag specifications – Google Search Centraldevelopers.google.com
- X-Robots-Tag – MDN Web Docsdeveloper.mozilla.org
- Introduction to robots.txt – Google Search Centraldevelopers.google.com
Last updated: