Page-level indexing controls come in two forms: the robots meta tag inside HTML, and the X-Robots-Tag HTTP response header. Google's documentation says they carry the same rules and that you can specify page-level settings either way. Text-level control uses the data-nosnippet attribute.
The basic syntax
In HTML, inside the <head>:
<meta name="robots" content="noindex">
As a response header:
X-Robots-Tag: noindex
Google's March 2025 Robots Refresher explains that the header was created to give non-HTML content the same level of control, and that Google supports it for formats like PDFs, document files and images, which have no meta equivalent.
Targeting one crawler
Omit a name to address all crawlers that support the rule, or name one:
<meta name="googlebot" content="noindex">
X-Robots-Tag: googlebot: noindex
Google's documentation notes that the plain robots rule applies to search engine crawlers, and that to block non-search crawlers such as AdsBot you may need rules aimed at that crawler specifically.
Common directives
| Directive | Effect |
|---|---|
| --- | --- |
noindex | Do not show the page in results |
nofollow | Do not follow links on the page |
nosnippet | Do not show a text snippet or preview |
max-snippet:[n] | Limit snippet length |
max-image-preview:[setting] | Limit image preview size |
unavailable_after:[date] | Stop showing after a date |
Directives can be combined, for example noindex, nofollow. The robots meta tag documentation is the authoritative list for Google, and Bing's October 2025 post lists noindex, nosnippet and the max-preview controls for Bing.
The rule that surprises everyone
Google states plainly that these settings can be read and followed only if crawlers are allowed to access the pages that include them. If robots.txt blocks the URL, the crawler never reads the tag or header. For removals, that means you must leave the page crawlable until it has dropped out. See noindex vs robots.txt vs 410.
Placement
Place the meta tag in the head. Google's documentation added a note in March 2026 explaining how robots meta tags outside the HTML head are processed, describing the behavior as unchanged. Our recommendation is simple: put the tag in the head and avoid relying on edge-case behavior. Also remember the byte limit: keep critical tags near the top of the document. See Inside Googlebot.
JavaScript
You can add or alter robots tags with JavaScript, but Google says that when it sees noindex it may skip rendering, so removing noindex with a script may not work. If you want a page indexed, do not ship noindex in the original code. See the December 2025 clarifications.
Implementing the header
Configure it at the server or CDN. Examples of what to target:
- all PDFs under a folder,
- generated exports or downloads,
- staging hosts,
- image files that should not appear in image results.
Apply the header with your server's pattern-matching rules. Keep the rule in version control, since a blanket header applied by mistake can de-index a whole site.
Verifying
- Fetch the URL and read the response headers for
X-Robots-Tag. - View the HTML source for the meta tag, not just the rendered DOM.
- Run URL Inspection on a sample and confirm indexing is reported as blocked by noindex.
- Check that robots.txt does not block the URL.
- Wait for recrawl. Google says it can take a long time for unimportant pages, and the Removals tool can hide them meanwhile. See the Removals tool guide.
data-nosnippet
Both Google and, since October 2025, Bing support data-nosnippet for excluding a part of a page from snippets. Bing says marked content stays indexed and available for ranking. See Bing adds data-nosnippet support.
Audit checklist
- Search templates for stray
noindexvalues left from staging. - Confirm headers on file downloads.
- Make sure no directive conflicts: a page with
noindexshould not also be in the sitemap. - Document who owns the rules.
Frequently asked questions
Can I use X-Robots-Tag on a PDF?
Yes. Google's documentation says a response header can be used for non-HTML resources such as PDFs, video files and image files.
Does a robots meta tag work on a page blocked by robots.txt?
No. Google states these settings can be read and followed only if crawlers are allowed to access the pages that include them.