Search 4 min read Updated
The robots meta tag and X-Robots-Tag
In short
Put a robots meta tag in the head of an HTML page and an X-Robots-Tag header on other files, and make sure robots.txt does not block the page.
The robots meta tag and the X-Robots-Tag header tell search engines what to do with a page or file: whether to index it, how much of it to show in a snippet, whether to follow its links, and whether to offer a translation. Before you set any of them, one condition must hold: the search engine has to be able to crawl the page. Without that, the directives do nothing.
The directives you will use most
Google’s specification for robots meta tags lists every directive. The table covers the ones most sites need. The default value, all, sets no restrictions.
| Directive | Effect |
|---|---|
| noindex | Do not show the page, media or resource in search results |
| nofollow | Do not follow the links on the page |
| none | The same as noindex and nofollow together |
| nosnippet | Do not show a text snippet or a video preview for the page |
| max-snippet | Cap the snippet length in characters; 0 is the same as nosnippet, and -1 leaves the length to Google |
| max-image-preview | Set the image preview size to none, standard or large |
| max-video-preview | Cap the video preview in seconds; 0 allows at most a static image |
| notranslate | Stop Google from offering a translation of the page |
| noimageindex | Stop the images on the page from being indexed |
| unavailable_after | Stop showing the page after a given date and time |
Some values have no effect. Google ignores noarchive, because the cached link feature no longer exists, and it does not use nocache or nositelinkssearchbox. Do not rely on them.
Combining directives and naming crawlers
You can list several directives in one comma-separated value, or give each its own meta tag. When rules conflict, the more restrictive one applies. For example, nosnippet overrides a max-snippet value of 50. The name attribute decides who the rule addresses: the value robots applies to all crawlers. The meta tag is read for only two crawler names, googlebot for the text results and googlebot-news for news results, and other names are ignored.
Where several crawlers have different rules, the restrictive ones add up. A nofollow rule for all crawlers together with a noindex rule for Googlebot means noindex and nofollow for Googlebot. The specification also notes that blocking a non-search crawler such as AdsBot-Google may need a rule aimed at that crawler. A canonical tag is a separate signal, and the article on canonical URLs covers it.
Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea
The X-Robots-Tag header
The X-Robots-Tag is an HTTP response header that accepts the same rules as the meta tag. It is the right choice for files that are not HTML, such as PDFs, images and video, where a meta tag is not possible. The header can be set for a whole site in the server configuration, for example in Apache or NGINX. It can also name a crawler before its rules, and rules without a name apply to all crawlers.
Crawl access comes first
Directives only work if the crawler can reach the page. If robots.txt blocks the URL, the indexing and serving rules on that page are never read, and they are ignored. A page blocked by robots.txt can still appear in results even when it carries a noindex tag, because the crawler never reads the tag. Google’s block-indexing guidance says that a page with noindex must not be blocked by robots.txt, and that noindex is not supported inside robots.txt. The article on robots.txt and noindex explains the difference between crawling and indexing in more detail.
A checklist for setting directives
- Decide which pages must stay out of results. Use noindex in the meta tag for HTML pages, and in the X-Robots-Tag header for other files.
- Check robots.txt and make sure none of those pages is blocked there.
- Combine directives with commas, and check that no later rule quietly overrides an earlier one.
- Use the googlebot name only when a rule should apply to Google’s search crawler alone.
- Check the Page Indexing report in Search Console, which shows the pages where Googlebot found a noindex rule. Pages you want in results belong in your sitemap, as the article on XML sitemaps explains.
This guide summarises two Google Search Central pages. The checklist and the advice on overlapping rules are general practice, not taken from those pages. The table lists only the directives that the specification describes.
Common questions
- What happens if robots.txt blocks a page that has noindex?
- Google cannot read the noindex rule, so the page can still appear in results. For noindex to work, the page must not be blocked by robots.txt.
- Can one rule address all search engines?
- Yes. The name robots applies to all crawlers. Google reads googlebot and googlebot-news as crawler names in the meta tag and ignores other names.
- Which header should I use for a PDF?
- Use the X-Robots-Tag response header, where a meta tag is not possible. The header accepts the same rules and can be set in the server configuration.
Sources
- Robots Meta Tags Specifications, Google Search Central. Accessed 24 November 2026
- Block Search indexing with noindex, Google Search Central. Accessed 24 November 2026
Further reading
-
robots.txt and noindex are different controls
robots.txt decides which URLs crawlers may fetch, while noindex decides whether a fetched page may appear in search results.
-
Canonical URLs when one page has many addresses
A canonical URL is the address you want search engines to treat as the main version, and you signal it with redirects, rel=canonical and your sitemap.
-
XML sitemaps that help search engines
An XML sitemap helps search engines find the pages you want considered, within the protocol limits of 50,000 URLs and 50 MB per file.
Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea