Every site owner wants Google to crawl the right pages and skip the rest. Three tools help with that job. They are robots.txt, the meta robots tag and the X-Robots-Tag header. They sound alike so people mix them up all the time. One wrong setting can hide your best page from search or leave a private page open to anyone.
This guide explains robots.txt vs meta robots vs x-robots-tag in plain words. You will see what each one does and how they differ and which one fits each job. You will also learn the mistakes that cause the most damage and how these controls affect AI search tools.
What Is the Difference?
Robots.txt tells crawlers which URLs they may visit. The meta robots tag tells search engines what to do with one HTML page after they crawl it. The X-Robots-Tag does the same job through the HTTP header and also works for PDFs and images. Robots.txt controls crawling. The other two control indexing and display.
Knowing robots.txt vs meta robots vs x-robots-tag is the base of any technical SEO setup. Crawl and index rules decide what search engines and AI tools can see on your site. A small mistake here can undo months of content work.
The Three Controls at a Glance
-
Robots.txt: a text file at the root of your domain that allows or blocks crawling
-
Meta robots tag: a line of code in the head of one HTML page that controls indexing and snippets
-
X-Robots-Tag: a rule your server sends in the HTTP header that does the same job for any file type
What Is Robots.txt?
Robots.txt is a plain text file that lives at yoursite.com/robots.txt. Crawlers read it before they fetch pages on your site. It lists rules for each crawler by name and says which folders or URLs they can or cannot visit.
The key point is that robots.txt manages crawling and not indexing. If you block a URL here but other sites link to it Google can still list that URL in results with no description. Google also stopped supporting the noindex rule inside robots.txt in 2019. The file is public too so anyone can read it. Never use it to hide private content.
What Robots.txt Can and Cannot Do
-
It can block crawlers from folders like /cart/ or /admin/
-
It can save crawl budget on large sites with many filter URLs
-
It can point crawlers to your XML sitemap
-
It can allow or block named bots such as Googlebot or GPTBot
-
It cannot remove a page from Google
-
It cannot stop a bad bot that ignores the rules
-
It cannot protect private data since anyone can open the file
A Basic Robots.txt Example
User-agent: *
Disallow: /cart/
Disallow: /search/
Allow: /
Sitemap: https://www.example.com/sitemap.xml
-
User-agent: * means the rules apply to all crawlers
-
Disallow blocks a path
-
Allow opens a path inside a blocked folder
-
Sitemap shows crawlers where your sitemap lives
What Is the Meta Robots Tag?
The meta robots tag sits inside the head section of a single HTML page. It gives search engines page level instructions. The most common use is telling Google not to index a page while still letting it crawl the page.
<meta name=”robots” content=”noindex, follow”>
Google has to crawl the page to read this tag. If robots.txt blocks the page the bot never sees the tag and the noindex does nothing. This is the most common mix up between the two controls. You can also target one bot by using its name in place of “robots” such as googlebot.
Pages with stray noindex tags are easy to miss on big sites. A free SEO audit tool can crawl your pages and flag noindex tags you did not plan.
Common Meta Robots Values
-
noindex: keep this page out of search results
-
nofollow: do not pass signals through the links on this page
-
nosnippet: do not show a text snippet or AI summary from this page
-
max-snippet: limit how many characters can show in a snippet
-
max-image-preview: set the largest image preview size
-
noarchive: do not offer a cached copy
-
unavailable_after: stop showing the page after a set date
What Is the X-Robots-Tag?
The X-Robots-Tag is an instruction your server sends in the HTTP response header. It supports the same values as the meta robots tag. The big difference is where it lives. A header is not part of the page code so it works for files that have no HTML head. That includes PDFs and images and videos and other downloads.
Here is how it looks in an Apache config for all PDF files:
<FilesMatch “.pdf$”>
Header set X-Robots-Tag “noindex, nofollow”
</FilesMatch>
And here is the same idea in Nginx:
location ~* .pdf$ {
add_header X-Robots-Tag “noindex, nofollow”;
}
Server rules are easy to get wrong and a bad line can affect the whole site. Many teams hand this work to a website maintenance and security team so changes are tested before they go live.
When the Header Is Your Best Choice
-
You want to keep PDFs or Word files out of search
-
You want to noindex images or videos
-
You need one rule for a whole folder or file type
-
You cannot edit the HTML of a page
-
You want to noindex pages made by a template you cannot change
Robots.txt vs Meta Robots vs X-Robots-Tag: Side by Side
This table shows the main differences in one view.
Key Differences in Short
-
Robots.txt acts before the crawl while the other two act after the bot fetches the page
-
Only the meta tag and the header can keep a page out of the index
-
Only the header can handle non-HTML files with full index control
-
Robots.txt works at site level while the tag works at page level
When to Use Each One
The right pick depends on your goal. Ask yourself one question first. Do I want bots to skip this URL or do I want them to see it but not list it?
Simple Rules for Picking the Right Control
-
Block filter and search result URLs that waste crawl budget: use robots.txt
-
Keep a thank you page or login page out of results: use meta robots noindex
-
Keep a PDF price list out of results: use X-Robots-Tag noindex
-
Remove a page that is already indexed: add noindex first and leave the page crawlable so Google can see it
-
Show shorter snippets on a page: use max-snippet in the meta tag
-
Stop bots from opening admin folders: use robots.txt and add real login protection too
-
Handle a thin page: improve the page before you hide it. A content marketing team can turn weak pages into pages worth ranking
Common Mistakes to Avoid
Most crawl and index problems come from a few repeat errors. Check your site for each one.
Mistakes That Hurt Rankings
-
Blocking a page in robots.txt and adding noindex: the bot never reads the noindex so the page can stay in results
-
Leaving a Disallow all rule after a site launch: staging rules often slip into the live site and block everything
-
Blocking CSS and JavaScript files: Google cannot render the page well and may judge it wrongly
-
Using robots.txt as security: the file is public and shows attackers where your private folders are
-
Typos in wildcards: one wrong character in a pattern can block far more than you planned
-
Mixed signals across the three controls: when a meta tag and a header disagree Google follows the most restrictive rule
-
Noindex on a page you want to rank: a template change can add it to hundreds of pages at once
How These Controls Affect AI Search
AI tools also read your crawl rules. Robots.txt is where you allow or block AI crawlers like GPTBot and ClaudeBot and PerplexityBot. Well behaved bots follow these rules but the rules are voluntary. Some bots ignore them.
Google has its own control called Google-Extended. It manages whether Google can use your content for Gemini training and grounding. Google says it does not affect your place in Search or your inclusion in AI Overviews. For AI Overviews and normal snippets Google follows snippet controls such as nosnippet and max-snippet and the data-nosnippet attribute.
Blocking AI crawlers can lower the chance that AI tools cite you. Allowing them can raise it. Make the choice based on your goals and not on habit.
Practical Steps for AI Search Visibility
-
Decide which AI bots you want to allow and write a clear rule for each in robots.txt
-
Keep pages you want cited crawlable and indexable
-
Avoid nosnippet on pages you want quoted in answers
-
Put a short direct answer near the top of key pages so tools can quote it
-
Review your rules every quarter since new bots appear often
How to Test Your Setup
Testing takes only a few minutes and it prevents costly errors. Run these checks after every site launch or template change.
Five Checks to Run
-
Open yoursite.com/robots.txt in a browser and read every line
-
Use the robots.txt report in Google Search Console to see if Google fetched the file without errors
-
Use the URL Inspection tool to check if a page is blocked or set to noindex
-
Right click a page and view the source to confirm the meta robots tag is what you expect
-
Run curl -I on a file URL to read the response headers and find any X-Robots-Tag
Conclusion
Each control has one clear job. Robots.txt decides where bots can go. The meta robots tag decides what happens to a single page. The X-Robots-Tag does the same for files that have no HTML head. Use them together but never let them fight each other.
Start by checking your live robots.txt and your most important pages for stray noindex rules. Keep pages you want to rank open and crawlable. Use noindex for pages that should stay out of results and leave those pages crawlable so the tag gets read. Recheck your setup after every big site change.
FAQs
What is the difference between robots.txt and meta robots?
Robots.txt controls whether a crawler can visit a URL. Meta robots controls what a search engine does with a page after it crawls it. One manages access and the other manages indexing and snippets.
Does robots.txt stop a page from being indexed?
No. It only blocks crawling. Google can still index a blocked URL without a description if other pages link to it. Use a noindex tag or header to keep a page out of results.
Can I use noindex in robots.txt?
No. Google stopped supporting the noindex rule in robots.txt in 2019. Use the meta robots tag or the X-Robots-Tag header instead.
What is the X-Robots-Tag used for?
It gives index and snippet instructions through the HTTP header. It is the best way to noindex PDFs, images and other files that have no HTML head. It also lets you set one rule for many files at once.
Which wins if robots.txt and meta robots conflict?
Robots.txt acts first. If it blocks the page the bot never reads the meta tag. If a meta tag and an X-Robots-Tag conflict Google follows the most restrictive rule.
Should I use noindex and Disallow together?
No. The Disallow rule stops Google from reading the noindex. Leave the page crawlable until it drops out of the index. Then you can block it if you still want to.
Does robots.txt hide pages from hackers?
No. The file is public and anyone can read it. Listing private folders there can even point people to them. Protect private areas with logins and server rules.
How long does Google take to respect a change?
Google usually caches robots.txt for up to a day. Meta robots and header changes apply after Google recrawls the page. That can take days or weeks depending on how often your site is crawled.
Do these controls affect AI Overviews and ChatGPT?
Snippet controls like nosnippet and max-snippet affect how Google shows your content in results and AI Overviews. Robots.txt rules for bots like GPTBot decide if those crawlers may read your pages. Google-Extended does not change your Search ranking.
How do I check my robots.txt and index settings?
Open your robots.txt file in a browser and use the robots.txt report and URL Inspection tool in Google Search Console. View the page source for the meta tag and run curl -I on a file to see its headers.

More Stories
Local SEO in 2026 Is Not What It Used to Be
February 2026 Discover Core Update Impact and Digital Marketing Company in Noida
Guest posting submission meaning history and why it still matters for SEO in 2026