Skip to main content
Guide 7 min read

robots.txt vs noindex: How to Actually Keep a Page Out of Google

You blocked a page in robots.txt. A week later you search for it and there it is, sitting in Google with a blank description. What went wrong? The robots.txt vs noindex question trips up experienced site owners, because the two tools sound like they do the same job. They don’t. And the wrong choice can keep a page in search results for months.

This guide explains what each one does, why blocking a page can keep it listed and how to remove a page the right way. You’ll also see when to skip both and use a password instead.

The short answer

Robots.txt controls crawling. Noindex controls indexing. Crawling means a bot visits a page and reads it. Indexing means Google stores the page and can show it in results. A page can be indexed without ever being crawled, and that one fact causes most of the confusion.

So if you want a page out of Google, you want noindex. If you want to keep bots away from a page to save server effort, you want robots.txt. Different goals, different tools.

What robots.txt does

Robots.txt is a plain text file at the root of your site. It tells crawlers which paths they may visit. Well behaved bots like Googlebot read it before they fetch anything else.

That’s all it does. It makes requests about crawling, and it says nothing about whether a URL may appear in search. It also works on trust. Good bots follow it, and bad bots ignore it and read the paths anyway.

A rule looks like this:

Disallow: /private/

Placed inside the group for your crawler, that line tells it to stay out of the private folder. Build a clean file with our robots.txt generator. Paths with special characters can trip a rule, so check them with our URL encoder decoder.

What noindex does

Noindex is a directive that tells search engines, “Don’t show this page in results.” You add it to the page as a meta tag, or you send it as an HTTP header.

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

When Googlebot crawls the page and sees that tag, it drops the page from the index. Notice the order. Google has to crawl the page first. Hold that thought, because it explains the biggest mistake in this whole topic.

The trap: blocking a page you want noindexed

Here’s the mistake behind most “my page won’t leave Google” complaints. Someone adds a noindex tag, then blocks the page in robots.txt to be safe. Now Googlebot can’t crawl the page, so it never sees the noindex. The tag sits there, ignored.

Two tools that should work together cancel each other out. If you want noindex to work, the page must stay open to crawlers. That feels backward, and it’s the most important rule in this guide.

Why a blocked page can still show up

Google finds URLs through links, not only through crawling. If other pages link to your blocked URL, Google can index the bare address without ever reading the page. You see a result with a title built from link text and a note that no description is available.

That result means Google knows the URL exists but was told not to look inside. It isn’t a bug. It’s robots.txt doing exactly what it promises, which is not what you wanted.

When to use each one

Ask one question: do you care that Google shows the page, or that bots visit it? If you care about the listing, use noindex. If you care about the visits, use robots.txt.

Use robots.txt when you:

  • Want crawlers to skip endless filter and internal search URLs.
  • Need to cut server load from heavy bots.
  • Want to keep bots out of folders that serve no search purpose.

One warning here. Don’t block the CSS and JavaScript files Google needs to render your pages.

Use noindex when you:

  • Have thank you pages that should never rank.
  • Run internal search results or thin tag pages.
  • Keep a test or duplicate version of a page live.
  • Need a PDF or other file out of results.

How to add noindex

You have three routes:

  • Meta tag. Put it in the head of the page. Most CMS tools and SEO plugins give you a checkbox for it.
  • HTTP header. PDFs, images and other files have no head, so send the X Robots Tag header with the value noindex. In your server config the header name is written with hyphens. One line in Apache or Nginx covers a whole path.
  • Site wide setting. WordPress has a setting that asks search engines to skip your entire site. Use it on a staging site, never on a live one.

After you add it, view the page source or the response headers and confirm the directive is there. Also confirm the page returns a normal 200 status. A page that redirects can’t carry noindex, because visitors never see it. For a moved page, use a 301 instead. Our guide on 301 vs 302 redirects explains how, and our redirect checker shows what a URL really returns.

What doesn’t work

These ideas sound reasonable and fail:

  • Noindex inside robots.txt. Google stopped honoring it in 2019.
  • Nofollow on your own links. Other sites can still link to the page, and Google follows those.
  • Canonical tags as a hiding tool. A canonical tag is a hint about duplicates, not a removal request.
  • Leaving the page in your sitemap. A sitemap says “index this” while noindex says “don’t.” Keep noindexed pages out of it, and rebuild a clean list with our sitemap generator.

When the page must stay private

Neither tool protects anything. Anyone with the URL can open the page. Worse, robots.txt is public, so a line that blocks a secret folder points curious people straight at it.

For private content, use a password, a login or a firewall rule. Google can’t read a page that returns a 401 or 403 error, so it usually drops out of results over time. Treat noindex as a polite request, and treat a login as a lock.

How to remove a page that’s already in Google

Follow these steps in order:

  1. Remove the robots.txt block for that URL so Googlebot can reach it.
  2. Add noindex to the page.
  3. Inspect the URL in Search Console and request indexing, so Google recrawls it.
  4. Wait. Removal takes days or weeks, depending on how often Google visits the page.
  5. Leave the noindex in place. Adding a robots.txt block later can bring the bare URL back if other sites link to it.

Need it gone fast? The Removals tool in Search Console hides a URL for about six months. That’s temporary, so pair it with noindex. If you deleted the page for good, return a 404 or 410 status and let Google catch up.

A checklist before you publish the change

Run through this list once:

  1. Decide whether you want to hide the page or just stop crawling.
  2. To hide it, add a noindex tag or header.
  3. Check that robots.txt doesn’t block the URL.
  4. Remove the URL from your sitemap.
  5. Confirm the page returns a 200 status and doesn’t redirect.
  6. Check the page source for the directive.
  7. Request a recrawl in Search Console.
  8. Add a login if the content is truly private.

Edited your robots.txt along the way? Compare the old and new versions with our text diff checker so a stray rule doesn’t block more than you meant to.

The short version

Robots.txt stops crawling, and noindex stops indexing. To keep a page out of Google, use noindex and leave the page open to crawlers so Google can read the tag. Never combine a block with noindex for one URL. For private content, use a password, because neither tool is a lock.

Pick one page you want hidden and check today whether your robots.txt blocks it. If it does, you’ve found your problem.

Free browser based tools on Black Claaw to build robots files, clean up sitemaps, check responses and compare config changes.

View all tools

Advertisement