Robots Meta Tags: How to Keep Pages Out of Search Results
In this guide
A robots meta tag is a small piece of code that tells search engines what they may do with a page. It sits in the head section of a webpage and gives instructions about indexing, following links, and how the page appears in search results. Used correctly, it is the most precise way to keep a page out of search results while leaving it available to visitors. Used incorrectly, it can hide pages you want found, or fail to hide pages you want private. This guide explains how it works and how to use it safely.
Many website owners confuse the robots meta tag with the robots file, known as robots.txt. The two do different jobs. The robots file tells search engines which parts of your site they may crawl. The robots meta tag tells them whether they may index a page they have already crawled. A page blocked in the robots file cannot be crawled, so a meta tag on that page will never be seen. If you want to control indexing, use the meta tag, and make sure the page is crawlable so the tag can be read.
This distinction matters for privacy. If you have a page that should not appear in search, such as a staging page, a thank-you page, or a member-only page, the robots meta tag is often the right tool. It hides the page from results without hiding it from the people who need it. But it is not a security tool: anyone who knows the address can still visit the page, so for truly private content, use a password as well.
What Is a Robots Meta Tag?
A robots meta tag is an HTML snippet placed in the head section of a webpage. It has two parts: a name, which says which search engines the instruction is for, and a content part, which gives the instruction itself. A typical example tells all search engines not to index the page and not to follow its links. If a page has no robots meta tag at all, search engines treat that as permission to index the page and follow its links.
The name part can target all search engines, or a specific one, such as Google's crawler. Most sites use the general name, which applies to all crawlers that respect the standard. The content part can combine several instructions, separated by commas, so one tag can say not to index the page, not to follow its links, and not to show a snippet in the results.
It is a simple system, but it is easy to get wrong. A typo in the tag, a tag placed in the wrong part of the page, or a tag on a page that is blocked from crawling will all cause the instruction to be ignored. Always test after adding a tag, using the URL inspection tool in Search Console to confirm that Google sees it.
Robots Meta Tag Values: Noindex, Nofollow and More
The most useful value is noindex, which instructs search engines not to index the page and prevents it from showing in search results. Use it for thin pages with little value to searchers, for pages in a staging environment, for thank-you pages, and for duplicate pages that you want visitors to read but do not want competing with your main pages in search.
The value nofollow tells search engines not to follow the links on a page. It is sometimes combined with noindex, and the combination noindex, nofollow is common for pages you want completely out of the search system. The value none means the same as noindex, nofollow, but some search engines do not support it, so it is safer to write the two values out in full.
Other values control how a page appears in results. The value nosnippet prevents search engines from showing a text snippet for the page. The value unavailable_after tells Google not to show a page in results after a specified date and time, which is useful for time-limited offers or event pages. Newer directives also control whether search engines may show a large image preview or a video preview for the page. You only need these advanced values in specific situations, but it is useful to know they exist.
What Is an X-Robots-Tag?
An X-Robots-Tag is the same idea as a robots meta tag, but delivered as an HTTP header instead of a tag in the page. It is used for files that do not have an HTML head section, such as PDFs, images, and other documents. A header response can carry the same instructions, for example telling search engines not to index a PDF file, and it works the same way once the file is crawled.
The X-Robots-Tag is also useful when you want to apply a rule to many pages at once, because you can set it in your server configuration rather than editing each page individually. For example, you can set a header that applies noindex to a whole folder of files with one rule. That is faster and less error-prone than editing hundreds of pages by hand.
When should you use the meta tag and when the header? Use the meta tag for normal web pages, because it is easy to see and edit in the page itself. Use the X-Robots-Tag for non-HTML files, and for site-wide rules that are easier to manage on the server. Both are respected by major search engines, and both need the page or file to be crawlable to work.
Common Robots Meta Tag Mistakes to Avoid
The most common mistake is combining a noindex tag with a robots file block. As explained earlier, a blocked page cannot be crawled, so the search engine never sees the noindex tag, and the page can stay in the index. If you want a page out of the index, remove the block, let the search engine crawl the page once, and let it see the tag. The page will then be removed.
Another mistake is using noindex on pages you want to rank. This happens more often than you might think, usually after a site redesign or a move from a staging site to a live site, when the staging settings are copied across by accident. A quick check of your most important pages in Search Console will catch this before it costs you weeks of traffic. If a page that should rank is not appearing in results, check its robots tag first.
A third mistake is relying on a robots meta tag for security. A noindex tag hides a page from search results, but it does not hide it from anyone who knows or guesses the address. If a page contains personal information, internal documents, or anything that should not be seen by the public, protect it with a password or a login, not just a noindex tag. Privacy needs access control, not just invisibility in search.
Finally, remember that other search engines may interpret directives slightly differently, and that it takes time for changes to take effect. After adding or removing a tag, allow days or weeks for search engines to recrawl the page and update their index. Check the result, keep a note of what you changed, and do not assume a change has worked until you have confirmed it. A robots meta tag is a small piece of code, but it is one of the most powerful privacy controls a website owner has. Use it carefully, and it will keep the right pages visible and the right pages hidden.
Earn
Zohaib Faisal is the founder and editor of EarnDesk. Based in Lahore, Pakistan, he runs the online store Haseeb Collections and works as a freelancer on Fiverr (virtual assistance, AI content writing, AI prompt engineering and digital marketing). He builds websites — Haseeb Collections, EarnDesk and a temporary-email service — writes SEO-focused content, and has hands-on AdSense experience across his sites. He has earned 15+ professional certificates from Google, IBM, Microsoft, HubSpot, Cisco, the Linux Foundation, Unity, Semrush and Harvard (CS50P), and creates the YouTube channel Clips by Zohaib. On EarnDesk he writes practical, honest guides to help beginners earn online — without hype or "get rich quick" promises.