Robots.txt vs. noindex and when to use each

Robots.txt tells search engines which URLs not to crawl, or visit. Noindex tells Google not to show a page in its results. A login keeps private content away from everyone. Pick the one that matches your goal, because a robots.txt block alone can still leave a URL in search results.

Does robots.txt keep a page out of Google?

No. A robots.txt rule can stop Google from crawling a page, but Google can still show its URL in search results.

High confidence. Strong evidence, or the platform says so in its own docs. Based on 5 sources: 1 observational study, 2 case studies, 2 official docs.

What to do

For a public page you want out of search results, let Google crawl it so it can read a noindex instruction.

On this page
  1. What to do
  2. Pick the control that matches your goal
  3. How to add noindex to a page
  4. Why is a page blocked by robots.txt still in Google?
  5. Keep private files behind a login
  6. Does nofollow keep a page out of Google?
  7. The evidence
  8. Related tactics

Pick the control that matches your goal

Use robots.txtrobots.txtA plain text file at the root of your site that tells search engine bots which pages they may crawl. to stop crawlingcrawlWhen a search engine’s bot visits a page and reads its content and links.. It’s a plain text file at example.com/robots.txt. A rule such as Disallow: /search/ asks GooglebotGooglebotThe program Google uses to visit and read web pages., Google’s crawler, to skip your internal search result pages. A blocked URL can still appear in Google if other pages link to it.

Use noindexnoindexAn instruction on a page that asks search engines not to show it in search results. The page still loads for anyone with the link. to keep a public page out of results. A thank-you page after a form can stay open to visitors. Google crawls it, sees the noindex tag, and leaves it out of search.

Use a login to protect private content. A member’s invoice should require signing in and permission to see that specific invoice. Check other ways to reach the same data, such as a direct link to the PDF.

Bottom line

Before you change any rule, write down what you want for each URL: fewer crawls, out of results, or private. That answer picks the tool.

How to add noindex to a page

Add the robots meta tag below inside the page’s <head>. Most SEO plugins have a setting for it. In Yoast SEO, for example, open the page’s Advanced tab and set the option that lets search engines show the page in search results to No.

Don’t block the same page in robots.txt. Google has to crawl the page to see the tag. Check for robots.txt rules that cover the whole folder, not just the exact URL.

For a file with no HTML, such as a PDF, send noindex in an X-Robots-Tag HTTP header instead. That’s an instruction your server sends along with the file. Check it in the live response headers in the Chrome DevTools Network tab, not in the page source.

To confirm, paste the URL into Search ConsoleSearch ConsoleGoogle’s free dashboard for site owners. It shows which searches bring people to your site and flags problems Google finds.’s URL Inspection and click Test live URL. Look for the noindex in the results and check that Google could fetch the page. If the page was already indexedindexWhen a search engine stores a page so it can show up in results. A page can be crawled and still not be indexed., it drops out after Google crawls it again.

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

Bottom line

Noindex only works if Google can crawl the page. Never pair it with a robots.txt block on the same URL.

Why is a page blocked by robots.txt still in Google?

Because robots.txt stops crawling, not indexing. If other pages link to a blocked URL, Google can still list it, usually without a description. Search Console calls this “Indexed, though blocked by robots.txt.”

Say /events/thank-you/ shows up in Google with no description. To remove it but keep it open to visitors, add noindex to the page. Then remove or narrow the robots.txt rule so Google can crawl the page and see the tag.

Be careful when you edit a shared rule. If Disallow: /events/ keeps thousands of other URLs out of the crawl, add an exception for the thank-you page only, such as Allow: /events/thank-you/. The result can stay in Google until Google crawls the page again. Check the Page indexing report to confirm it’s gone.

Bottom line

To get a blocked page out of Google, unblock it and add noindex. Change only the rule for that page, not the whole folder.

Keep private files behind a login

Skip it Search control only

Noindex is not a lock. A noindexed page still opens for anyone who has the link. A staff training calendar might be fine to share by link while staying out of Google. A payroll file should only open for authorized staff. Add a login, or take the file offline, before you think about search.

To test, copy the exact links to the private page and any attached files. Open each in a private browser window while signed out. Then try again with an account that shouldn’t have access. Neither should show the contents. Test direct download links for PDFs too, not just the page.

Bottom line

If someone shouldn’t see a file, it needs a login. Noindex and robots.txt only speak to search engines.

See the evidence for Use noindex to keep pages private

No. A page with noindex still opens for anyone who has the link. To keep it private, require a login or take it offline.

Google describes noindex as a search-indexing rule. It recommends password protection when you need to limit who can access the page.

  • Google Search Central · Official guidance · 2025

    Remove your site info from Google

    Google explains that noindex keeps a page out of its search results but users can still reach the page. Password protection limits access.

    The guidance distinguishes search removal and access. It does not audit any site’s authentication.

Does nofollow keep a page out of Google?

Skip it A crawl hint

No. Adding rel="nofollownofollowA label on a link that tells Google not to treat it as a vote for the page it points to. Google treats it as a hint." to a link labels that link, not the page it points to. Google treats nofollow as a hint and can still find the page through other sites’ links or a sitemapXML sitemapA file that lists the pages on your site you want search engines to find, so they don’t have to discover every page through links..

If you own the page and want it out of results, add noindex to that page and let Google crawl it. If another team owns it, send them the exact URL and what you need. For private material, ask the owner to put it behind a login first.

Bottom line

To control whether a page shows up in Google, change the page itself with noindex or a login. A nofollow link won’t do it.

See the evidence for Use nofollow to keep a linked page out of Google

No. Google treats nofollow as a hint, and it can still find the page through another link or a sitemap.

Google distinguishes a hint on an individual link from a rule on the linked page. The latter lets you make an explicit indexing choice.

  • Google Search Central · Official guidance · 2019

    Evolving "nofollow" – new ways to identify the nature of links

    Google announced that nofollow became a hint for crawling and indexing on March 1, 2020.

    The change does not mean Google follows every marked link or passes ranking credit.

  • Google Search Central · Official guidance · 2025

    Qualify your outbound links to Google

    Google says the destination may still be discovered through sitemaps or other links. It recommends a crawlable noindex directive for preventing index inclusion.

    This guidance concerns Google and does not describe every crawler’s implementation.

The evidence

Google documents this distinction explicitly. A small real-site test also found blocked pages could still show up in search.

  • Google Search Central · Official guidance · Last updated 2025

    Introduction to robots.txt

    Google can still index or show a disallowed URL discovered through links, even without crawling its content. The search result may have no description.

    This finding covers web-page URLs, not the separately documented behavior of media files.

  • Ahrefs · Case study · 2023

    The Story of Blocking 2 High-Ranking Pages With Robots.txt

    Both pages continued appearing in Google results, although they lost featured snippets and their search listings changed.

    Two previously ranked pages on one site, no comparison group. This cannot establish how other blocked URLs would behave or how often they stay visible.

  • Google Search Central · Official guidance · Last updated 2025

    Block Search indexing with noindex

    Google says it must crawl the page and read the noindex directive for it to take effect. Blocking the URL in robots.txt can prevent that.

    The directive takes effect after crawling. This is the appropriate alternative for readable public pages, not a traffic study.

  • SEO Depths · Case study · 2024

    Analyzing the Causal Impact of Robots.txt Block on SEODepths

    Previously indexed pages remained in Search Console’s indexed-though-blocked category in October. Google Search impressions and clicks continued during the blocked period. The author’s full-period model estimated a 21% decrease in clicks compared with projected performance.

    One site and a model-based comparison without an unchanged site or page group. The author published and promoted a new post during the block. Aggregate data do not establish whether every URL stayed visible.

  • Indexing Insight · Observational study · 2026

    How to fix 'Indexed, though blocked by robots.txt' [Case Study]

    Search Console showed roughly 500 linked scheduling-parameter URLs indexed despite being blocked from crawling.

    Anonymized client, no controlled comparison. Search Console indexing status does not mean every URL appeared to searchers.

Every source above was checked against the original by a second reviewer. How we rate the evidence