TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is the X-Robots-Tag? Syntax, examples and when to use it

X-Robots-Tag is an HTTP response header that tells search engines whether to index a URL and how to show it. Syntax, directives, server examples, and how it differs from meta robots and robots.txt.

Xu An Reviewed by Chen Yu Also called X-Robots-Tag header Last updated Nov 4, 2026 Glossary

Quick answer

X-Robots-Tag is an HTTP response header that gives search engine crawlers indexing instructions, such as noindex or nofollow, for the URL being served; unlike the robots meta tag, it works for any file type, including PDFs and images.

Formula: X-Robots-Tag: [user-agent:] directive[, directive]

What is the X-Robots-Tag?

X-Robots-Tag is an HTTP response header that gives crawlers indexing instructions for the URL being served:

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

It does the same job as the <meta name="robots"> tag, but because it is a header it works for any file type (PDFs, images, videos, feeds) and can be applied to whole folders or file types in server configuration.

Common directives

DirectiveEffect
noindexDo not show this URL in search results
nofollowDo not follow links on this page
noneSame as noindex, nofollow
nosnippetDo not show a text snippet or video preview
noimageindexDo not index images on this page
max-snippet:[n]Limit the snippet to n characters
unavailable_after:[date]Stop showing the URL after this date

Directives can target one crawler: X-Robots-Tag: googlebot: noindex.

X-Robots-Tag vs meta robots vs robots.txt

robots.txtMeta robotsX-Robots-Tag
ControlsCrawling (fetching)Indexing and displayIndexing and display
WhereOne file at the site rootIn each HTML pageIn HTTP response headers
File typesAnyHTML onlyAny
ScopePaths and patternsOne pageOne URL, or many via server rules

The classic trap: blocking a URL in robots.txt and adding noindex. The crawler is not allowed to fetch the URL, so it never sees the noindex, and the URL can still show up in results (usually without a snippet). To remove a URL from search, allow crawling and send noindex.

Configuration examples

Nginx, keep all PDFs out of search:

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

Apache (.htaccess), same rule:

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

Cloudflare Worker, noindex a staging host:

const res = await fetch(request);
const out = new Response(res.body, res);
if (new URL(request.url).hostname.startsWith('staging.')) {
  out.headers.set('X-Robots-Tag', 'noindex');
}
return out;

Verifying it

curl -sI https://example.com/files/report.pdf | grep -i x-robots-tag

In Google Search Console, the URL Inspection tool reports "Excluded by 'noindex' tag" once the page has been recrawled.

AI crawlers

Google's crawlers honour X-Robots-Tag; Google-Extended (training for Gemini) is controlled in robots.txt rather than with a header. Other AI crawlers mostly document robots.txt rules only, so use robots.txt or a server-side block for them.

What TapCub can check

TapCub's crawler compliance page (Monitoring › Crawler compliance) fetches your robots rules file and compares it with real crawler fetches, listing crawlers that fetched blocked paths or ignored the declared delay. It does not inspect response headers, so it cannot confirm that an X-Robots-Tag was sent; use curl or Search Console for that. Crawl health shows which pages each search engine fetched and their status codes once server logs are imported. See also robots.txt disallow all.

See also

Was this explanation clear?

We use your answers to fix and expand this page.

Xu An

Customer Experience Consultant

Writes about live chat, visitor conversations, and self-service, sharing practical ways to make customer communication clearer and more effective.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What does X-Robots-Tag: noindex do?

It tells search engines not to show that URL in search results. The crawler must still be allowed to fetch the URL to see the header.

What is the difference between X-Robots-Tag and meta robots?

They support the same directives. The meta tag lives in HTML, so it only works for HTML pages; the header can be sent with any response, such as PDFs, images or feeds, and can be set for many URLs at once in server config.

Can I use robots.txt and noindex together?

Not on the same URL. If robots.txt blocks crawling, the crawler never fetches the page and never sees the noindex, so the URL can still appear in results.

Do AI crawlers respect X-Robots-Tag?

Google’s crawlers do. Other AI crawlers vary; many only document robots.txt. For those, block by user agent in robots.txt or at the server.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics