Audit my site
Technical SEOIntermediateChecked against Google docs · Oct 2026

Meta robots and X-Robots-Tag: every rule, the syntax and how conflicts resolve

The robots meta tag and the X-Robots-Tag header decide whether a URL may be indexed and how it may be shown in search. They only work when Google can crawl the URL and read them.

Author: Eugene Serbin, Head of SEO at Semalt Updated: 29 October 2026 Reading time: 14 min Visuals: 5

In short

The robots meta tag and the X-Robots-Tag HTTP header tell Google whether a page or file may be indexed, whether its links should be followed and how it may be shown in search results. The meta tag works only for HTML pages; the header works for any file, including PDFs and images. Both only work if Google can crawl the URL, so a page blocked in robots.txt keeps its noindex secret.

What the robots meta tag and X-Robots-Tag are

Both are page-level instructions. They do not control crawling of the whole site, as robots.txt does. They tell Google what to do with one specific URL once it has been fetched: index it or not, follow its links or not, and how much of it to show as a snippet.

The robots meta tag sits in the <head> of an HTML page. You can edit it in your CMS or template, and it applies only to the page it is on.

The X-Robots-Tag is an HTTP response header. Your server sends it together with the file, so it works for anything the server returns: HTML, PDFs, images, feeds. Files without an HTML <head> cannot carry a meta tag, so for them the header is the only way to set a noindex.

Code · The same rule as a meta tag and as an HTTP header

Meta tag · in the HTML

<head>
  <meta name="robots"
        content="noindex">
</head>
  • HTML pages only
  • Set in the CMS or template
  • Visible in the page source

HTTP header · in the response

HTTP/2 200
content-type: application/pdf
x-robots-tag: noindex
  • Any file type: HTML, PDF, images
  • Set in the server or CDN config
  • Visible only in the response headers
Both lines give Google the same instruction; the header is simply delivered by the server instead of the page.

Without any robots rule, a page is treated as index, follow. That is the default, so you never need to write it.

Cheat sheet · What each robots rule does
all

No restrictions. Same as having no tag.

noindex

Keep the page or file out of search results.

nofollow

Do not follow the links on this page.

none

Short for noindex, nofollow.

nosnippet

No text snippet or video preview.

max-snippet:[number]

Limit the text snippet to that many characters.

max-image-preview:[setting]

Largest image preview: none, standard or large.

max-video-preview:[number]

Limit the video preview to that many seconds.

notranslate

No translation offer in search results.

noimageindex

Do not index the images on this page.

unavailable_after:[date/time]

Drop the page from results after that moment.

indexifembedded

Works only together with noindex.

Twelve rules cover indexing, link following and snippets; the exact Google definitions are in the table below.

What Google officially says

“The X-Robots-Tag can be used as an element of the HTTP header response for a given URL.”

Google Search Central — Robots meta tag specifications. Google's own example is X-Robots-Tag: noindex.

“In the case of conflicting robots rules, the more restrictive rule applies.”

Google Search Central — Robots meta tag specifications

“You can create a multi-rule instruction by combining robots meta tag rules with commas or by using multiple meta tags.”

Google Search Central — Robots meta tag specifications

“Google supports two user agent tokens in the robots meta tag; other values are ignored”

Google Search Central — Robots meta tag specifications. The two tokens are googlebot, “for all text results”, and googlebot-news.

“Both the name and the content attributes are case-insensitive.”

Google Search Central — Robots meta tag specifications

“We don't recommend using noindex to prevent selection of a canonical page within a single site.”

Google Search Central — How to specify a canonical URL

One more point from the same documentation matters in practice: if robots.txt disallows crawling of a page, Google cannot see its robots meta tag or X-Robots-Tag, so those rules are ignored.

Every rule Google supports

The middle column is Google's definition, quoted word for word. The right column is when you would actually use the rule.

RuleGoogle's definitionWhen to use it
all“There are no restrictions for indexing or serving.”Practically never. It is the default, and writing it changes nothing.
noindex“Do not show this page, media, or resource in search results.”Pages that should exist for users but not in search: internal search results, thank-you pages, account pages. The URL must stay crawlable.
nofollow“Do not follow the links on this page.”Rarely needed. It applies to every link on the page, for example a page made only of user-submitted links you do not vouch for.
none“Equivalent to noindex, nofollow.”A shorthand. Writing noindex, nofollow is clearer to the next person who reads your code.
nosnippet“Do not show a text snippet or video preview in the search results for this page.”Pages whose text you do not want quoted in results. The page can still rank, but with less to show.
max-snippet:[number]“Use a maximum of [number] characters as a textual snippet for this search result.”When you want to allow a short snippet but not long extracts of your text.
max-image-preview:[setting]“Set the maximum size of an image preview for this page in search results.”Values are none, standard and large. Use large if you want large image previews allowed; use none or standard to limit them.
max-video-preview:[number]“Use a maximum of [number] seconds as a video snippet for videos on this page in search results.”Pages with video where you want to cap the length of the preview.
notranslate“Don't offer translation of this page in search results.”Pages where a machine translation would be misleading, such as legal texts or language-learning material.
noimageindex“Do not index images on this page.”When the page itself should be indexed but its images should not be indexed from it.
unavailable_after:[date/time]“Do not show this page in search results after the specified date/time.”Time-limited pages: an event, a promotion with a fixed end date.
indexifembedded“indexifembedded only has an effect if it's accompanied by noindex.”Content such as a widget or player that is embedded in other pages (for example in an iframe). Together with noindex, it keeps the standalone URL out of search while allowing its content to be indexed as part of the page that embeds it.

Syntax and examples

The basic meta tag

Put the tag in the <head> of the page. The name attribute says which crawlers the rule is for; robots means all of them.

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

Rules only for Google

Replace robots with one of the two user agent tokens Google supports. googlebot covers all text results; googlebot-news applies to Google News.

<meta name="googlebot" content="noindex">
<meta name="googlebot-news" content="nosnippet">

Combining rules

Separate several rules with commas in one tag, or use several tags. Both versions below mean the same thing.

<!-- one tag -->
<meta name="robots" content="max-snippet:120, max-image-preview:large">

<!-- two tags -->
<meta name="robots" content="max-snippet:120">
<meta name="robots" content="max-image-preview:large">

X-Robots-Tag in nginx

To keep every PDF on the site out of search, add the header in a location block that matches PDF files:

location ~* \.pdf$ {
    add_header X-Robots-Tag "noindex";
}

Keep in mind that in nginx an add_header inside a location replaces the add_header lines inherited from the server level, so repeat any other headers you need there.

X-Robots-Tag in Apache

In the virtual host config or .htaccess, use a FilesMatch block. The Header directive needs mod_headers enabled.

<FilesMatch "\.pdf$">
    Header set X-Robots-Tag "noindex"
</FilesMatch>

PDFs, images and other files

Change the pattern to cover other file types, for example \.(pdf|docx)$. For images, the header on the image file itself keeps that file out of search. If you only want to stop Google indexing images from one HTML page, use noimageindex on that page instead.

Conflicts and precedence

Google reads every robots rule it finds for a URL: the meta tags, the googlebot tag and the X-Robots-Tag header. If they disagree, the more restrictive rule applies. A page that says index in one place and noindex in another ends up with noindex.

The meta tag and the header are not ranked against each other. Neither one overrides the other; Google simply takes the stricter of the two.

Diagram · When rules conflict
Conflicting robots rules and robots.txt blocking Case A: the page has a meta robots noindex tag and the server sends X-Robots-Tag index. Google applies noindex because the more restrictive rule wins. Case B: robots.txt disallows /private/, so Googlebot does not fetch the page and never sees its noindex tag; the URL can still be indexed from links, without its content. A · META TAG AND HEADER DISAGREE B · ROBOTS.TXT BLOCKS THE URL <meta name="robots" content="noindex"> X-Robots-Tag: index Google applies: noindex the more restrictive rule wins robots.txt Disallow: /private/ Googlebot does not fetch the page <meta … noindex> never seen, so ignored The URL can still be indexed from links, without its content.
Between two robots rules the stricter one wins, but a robots.txt block stops Google from reading either of them.

robots.txt blocking

robots.txt controls crawling, not indexing. If a URL is disallowed, Google never fetches it, so it never reads the robots meta tag or the X-Robots-Tag header. If other pages link to that URL, it can still appear in search, usually without a description.

So the rule is simple: if you want a page out of the index, let Google crawl it and show it the noindex. Never combine noindex with a robots.txt Disallow on the same URL.

Page-level nofollow vs rel="nofollow"

A nofollow in the robots meta tag applies to every link on the page. A rel attribute applies to one link only. Use the attribute on single links: rel="sponsored" for paid links, rel="ugc" for links in comments and forum posts, rel="nofollow" for other links you do not want to vouch for.

<a href="https://example.com/partner/" rel="sponsored">Our partner</a>

The link-level values nofollow, sponsored and ugc are hints, not strict commands.

What happens to links on noindex pages

A noindex page can still have its links followed for a while. Over time, though, pages that stay noindex are crawled less often, and a long-term noindex, follow tends to end up treated like noindex, nofollow. Do not rely on noindex pages to pass links. If a page is an important path to other pages, keep it indexable or make sure those pages are linked from elsewhere too.

When to use noindex and when not to

Checklist · Good and bad uses of noindex

✓ Good uses

  • Internal site search results
  • Thank-you and confirmation pages
  • Thin tag archives
  • Login and account pages
  • Staging sites (password protection is better)
  • Duplicate copies of legal boilerplate

✕ Bad uses

  • Product variants that duplicate the main product: use a canonical
  • Pages that moved to a new URL: use a 301
  • Whole sections, to save crawl budget: noindex pages are still crawled
  • Pages that bring traffic or sales
noindex is for pages that must exist for users but have no place in search.

For staging sites, a noindex works, but HTTP authentication is better: it keeps out both crawlers and curious visitors, and there is no tag to forget when the site goes live.

noindex, canonical, 301 or robots.txt

Decision tree · noindex, canonical, 301 or robots.txt?
Choosing between a 301 redirect, a canonical, robots.txt and noindex If the page moved permanently, use a 301 redirect. If it duplicates another URL, use rel=canonical. If Google does not need to crawl it at all, use a robots.txt Disallow, which stops crawling but not indexing. If it should not appear in search, use noindex and keep it crawlable. Otherwise index it. YesYesNoNo NoNoYesYes Has the page movedpermanently to a new URL? Is it a duplicate of anotherURL you want shown? Does Google need tocrawl it at all? Should this page appearin search? 301 redirectrel="canonical" robots.txt Disallownoindex to the new URLto the main URL, keep both crawlable stops crawling, not indexingkeep it crawlable, out of the sitemap Index it no robots rule needed, in the sitemap
Duplicates are consolidated with a canonical or a 301, not hidden with noindex; robots.txt is for crawling only.

Snippet controls

Some rules do not affect indexing at all. They only limit how much of the page Google may show.

Hiding part of a page: data-nosnippet

Google says: “You can designate textual parts of an HTML page not to be used as a snippet.” Add the data-nosnippet attribute to a span, div or section element. The text stays on the page and is still indexed; it just is not quoted in the snippet.

<p>Our standard delivery takes 3–5 days.
  <span data-nosnippet>Prices shown are valid today only.</span>
</p>

Snippet controls and AI features

Snippet controls such as nosnippet and max-snippet also limit how your content is shown in AI features in Google Search. That cuts both ways: it keeps your text from being quoted, but nosnippet can also reduce how visible the page is. Use it on specific pages for a clear reason, not site-wide.

Removing a page from Google fast

  1. Add noindex to the page, or make it return 404 or 410 if it should be gone for users too.
  2. Keep it crawlable. Do not block the URL in robots.txt, or Google will never see the change.
  3. Request indexing in Search Console URL Inspection so Google recrawls the page sooner.
  4. Use the Removals tool if it is urgent. It hides the URL from results only temporarily, so it never replaces step 1.

How to check what Google sees

URL Inspection

In Search Console, inspect the URL and look at Indexing allowed? in the page indexing details. If it says no, Google found a noindex. Run a live test to check the current version of the page rather than the last crawl.

Response headers with curl

The X-Robots-Tag never appears in the page source, so check the response headers directly:

$ curl -I https://example.com/files/price-list.pdf
HTTP/2 200
content-type: application/pdf
x-robots-tag: noindex

Browser developer tools show the same information in the Network tab, under the response headers.

Raw and rendered HTML

Compare the HTML your server sends (view source, or curl without -I) with the rendered page in URL Inspection. The robots meta tag should be the same in both.

noindex and JavaScript

If the server HTML contains noindex, Google may skip rendering the page, so removing the noindex with JavaScript may not work. Adding noindex with JavaScript is also unreliable. Keep robots rules in the server response.

Check the robots rules on your site

OurSEO Tools crawls your site and records the indexability of every page, including its meta robots tag and X-Robots-Tag header, so you can find stray noindex rules in one run.

69-point checklistTechnical crawlContent analysis

Common mistakes

FAQ

Can I use robots.txt to noindex a page?

No. robots.txt only controls crawling, and a blocked page cannot show Google its noindex. Put noindex in the meta tag or the X-Robots-Tag header and keep the URL crawlable.

Do I need to add index, follow to my pages?

No. It is the default. Writing it does no harm, but it does nothing either.

Does a page-level nofollow stop the page from being indexed?

No. nofollow only applies to the links on the page. To keep the page out of search, you need noindex.

Can I use several robots meta tags on one page?

Yes. Google says you can combine rules “with commas or by using multiple meta tags.” If the tags conflict, the more restrictive rule applies.

How do I noindex a PDF or an image?

Send the X-Robots-Tag header with the file. Files without HTML cannot carry a meta tag, so the header is the only way.

How long until a noindex page drops out of search?

It disappears after Google recrawls it and sees the rule, so it depends on how often the page is crawled. Requesting indexing in URL Inspection can speed this up.

Sources

Quotes checked against the official pages on 29 October 2026.