robots.txt controls whether a crawler may fetch a URL, and noindex controls whether a fetched URL may stay in the index. A noindex rule is only read on a crawlable URL, so a Disallow on the same page hides it, and a disallowed URL linked from elsewhere can still be listed without a description. Use robots.txt to manage crawling, noindex to exclude crawlable pages, and authentication for anything private, and verify each change on the live URL.
robots.txt decides whether a crawler is allowed to fetch a URL. A noindex rule decides whether a fetched URL may stay in the search index. The two controls act at separate steps, so they are not interchangeable, and combining them on the same URL usually defeats the one you care about. The usual split: leave a page crawlable and mark it noindex to keep it out of Google, disallow a large set of low-value URLs in robots.txt to manage crawling, and put anything private behind authentication.
Google describes Search as three stages: crawling (finding out what pages exist), indexing (working out what a crawled page is about and storing it), and serving (matching indexed pages to a query). Its documentation adds that "not every page that Google processes will be indexed," and it lists "robots.txt rules preventing Googlebot's access to the page" among the reasons a page is blocked. The file sits in front of the first stage. A noindex rule is read during the second, after the page has been fetched, so it works only on a page that robots.txt lets through.
Google's March 2025 Robots Refresher makes the same point from the other direction: page-level instructions "are sent together with a URL, so crawlers can only take them into account if they're not disallowed from crawling the URL through the robots.txt file."
| robots.txt | noindex (meta tag or X-Robots-Tag) | |
|---|---|---|
| Where it lives | One file at the root of each host, protocol and port | In the HTML head of a page, or in the HTTP response for any file type |
| Question it answers | May this crawler request this URL? | May this fetched URL appear in search results? |
| Needs the URL to be crawlable | No, it is what blocks crawling | Yes, the crawler has to fetch the URL to read the rule |
| Keeps a URL out of results | Not reliably, a blocked URL can still be listed without a snippet | Yes, once the URL is recrawled and the rule is processed |
| Reduces crawl requests | Yes | No, the URL still has to be fetched to see the rule |
| Works for PDFs and images | Yes, by path or extension | Yes, through the X-Robots-Tag header |
The last row deserves emphasis. RFC 9309, the Robots Exclusion Protocol standard, states plainly that "these rules are not a form of access authorization." Compliant crawlers follow the file, others ignore it, and anyone can read it, so an entry naming a private directory also advertises it.
The protocol was an informal convention for decades before its 2022 standardization as RFC 9309. Google's robots.txt specification follows the RFC and documents where Google's behavior is more specific. The details below come from those two unless noted.
Structurally, a robots.txt file is a sequence of groups. Each group starts with one or more User-agent lines naming the crawlers it applies to, followed by Allow and Disallow rules. A Sitemap line stands apart from the groups: Google says it is not tied to any user agent, takes a full absolute URL, and can appear more than once.
# https://www.example.com/robots.txt
User-agent: *
Disallow: /cart/
Disallow: /search
User-agent: Googlebot-Image
Disallow: /drafts/
Sitemap: https://www.example.com/sitemap.xmlOnly one group applies to a given crawler, and it is the group with the most specific matching user-agent token. In the example, Googlebot-Image obeys its own group and ignores the * group completely, so /cart/ and /search are not blocked for it. Google states that specific groups and the * group are not merged, and the order of groups in the file is irrelevant. If several groups name the same specific crawler, their rules are combined. The RFC adds that user-agent matching is case-insensitive and a crawler with no matching group falls back to *.
A correct-looking file often breaks this way: someone adds a group for one crawler to change a single rule and forgets to repeat the * rules inside it.
Paths in rules are matched from the start of the URL path and query string, and they are case-sensitive. A rule is a prefix, so Disallow: /fish also blocks /fishheads/yummy.html and /fish.html. Two special characters are supported: * matches zero or more of any character, and $ anchors the end of the URL. Google ignores a trailing *.
| Rule | Matches | Does not match |
|---|---|---|
| /fish | /fish.html, /fishheads/yummy.html | /Fish.asp, /catfish, /desert/fish |
| /fish/ | /fish/, /fish/salmon.htm | /fish, /fish.html |
| /*.php | /index.php, /folder/filename.php?parameters | /, /windows.PHP |
| /*.php$ | /filename.php, /folder/filename.php | /filename.php?parameters, /filename.php5 |
| /fish*.php | /fish.php, /fishheads/catfish.php?parameters | /Fish.PHP |
When an Allow and a Disallow both match a URL, the longer (more specific) rule wins. The RFC defines the most specific match as the one with the most octets. Google adds a tie-breaker: when rules conflict, including rules with wildcards, it uses the least restrictive one, so Allow: /folder beats an identical Disallow: /folder. In Google's examples, Allow: /p overrides Disallow: / for /page, and Disallow: /*.htm overrides Allow: /page for /page.htm, since the longer pattern wins. Allow: /$ matches only the home page.
The file must be named robots.txt in lowercase, sit at the top level of the host, and be UTF-8 text. Crawlers do not look for it in subdirectories. Google says the rules cover only the host, protocol and port where the file is served, so https://www.example.com/robots.txt does not govern https://blog.example.com/, http://www.example.com/ or https://www.example.com:8080/. Each subdomain needs its own file, and so does each environment that has its own hostname.
Google enforces a size limit of 500 kibibytes and ignores content beyond it; the RFC sets the minimum parsing limit crawlers must support at the same figure. The limit is rarely a problem. The HTTP Archive's 2025 Web Almanac reports that only 0.1% of sites exceeded the 500 KB cutoff, and 98% of files were under 100 KB.
Crawlers cache the file. The RFC says they should not use a cached copy for more than 24 hours unless the file is unreachable, and Google says it generally caches robots.txt for up to 24 hours, possibly longer when a refresh fails and possibly shorter or longer depending on Cache-Control: max-age. After you change the file, the Search Console robots.txt report has a recrawl request, though Google notes it does not guarantee that newly unblocked URLs are recrawled immediately.
What happens when the file cannot be fetched depends on the response, and the cases that surprise people are the 4xx family and the 5xx family.
| Response | Google's treatment |
|---|---|
| 2xx | The file is processed as served. If the body is HTML, Google tries to extract valid rules from it. |
| 3xx | At least five redirect hops are followed. After that the file is treated as a 404. Logical redirects (JavaScript, meta refresh, frames) are not followed. |
| 4xx except 429 | Treated as if no valid robots.txt exists, so no crawl restrictions apply. This includes 401 and 403. |
| 5xx, 429, timeouts, DNS or connection failures | Google stops crawling for the first 12 hours and keeps retrying. For up to 30 days it uses the last good cached copy, or assumes no restrictions if it has none. After 30 days it acts as if no file exists, unless the site has general availability problems, in which case crawling stays stopped. |
On unreachable files the RFC is stricter than Google: crawlers "MUST assume complete disallow" on a 5xx, and "MAY access any resources" on a 4xx. The practical consequence is that a robots.txt behind a login, a firewall rule or a bot-protection challenge can silently turn into an open site for Google, while a robots.txt that intermittently errors can pause crawling of an entire host. The Web Almanac measured robots.txt responses at 85% 200s, 13% 404s, about 1% timeouts, 0.5% 403s and 0.1% 5xx.
Google supports user-agent, allow, disallow and sitemap. Its documentation says other fields such as crawl-delay are not supported, and the parser ignores unknown lines without breaking grouping.
A Noindex: line in robots.txt is the old trap. Google never documented it, but it was widely used, and in a July 2019 post Gary Illyes announced that Google would retire all code handling unsupported and unpublished rules, noindex included, on September 1, 2019. The post said usage of these rules was "contradicted by other rules in all but 0.001% of all robots.txt files." Google's block-indexing documentation now states that it does not support noindex in robots.txt, so a file that still carries one relies on behavior that ended years ago.
Bing differs on crawl-delay. In a Bing Webmaster blog post the team says BingBot honors the directive and defines it as "the size of a time window (from 1 to 30 seconds) during which BingBot will crawl your web site only once." The post says this is not a crawl rate, that each subdomain is handled separately, and that a crawl delay in robots.txt overrides the setting in Bing Webmaster Tools. The post dates from 2012 and Bing's current help pages could not be read by the fetch tooling used for this article, so confirm current behavior in Bing Webmaster Tools. A blanket Crawl-delay does nothing for Google and may slow Bing.
Noindex tells a search engine not to show a URL in results. Google's block-indexing documentation says it can be set two ways with the same effect: a robots meta tag in the page, or an HTTP response header. Both are read only when the URL is fetched.
<head>
<meta name="robots" content="noindex">
</head>HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindexPer Google's robots meta tag reference, the name and content values are case-insensitive, rules can be combined with commas or split across several tags, and none is shorthand for noindex, nofollow. The header accepts any rule the meta tag accepts, as several headers or one comma-separated list.
Rules can target one crawler. In the meta tag, the name googlebot addresses Google's web results and googlebot-news addresses news results, and Google says other values are ignored. In the header a user agent is a prefix on the rule.
X-Robots-Tag: googlebot: noindex
X-Robots-Tag: otherbot: noindex, nofollowWhen rules conflict, the more restrictive one applies, and when different crawlers get different rules Google combines the negative ones. Google's example: a page with nofollow for all crawlers and noindex for Googlebot is treated by Googlebot as noindex, nofollow.
A PDF has no head element, so the header is the only page-level option. The Robots Refresher notes that Google supports the header for PDFs, document files and even images. Google's documentation gives server snippets for it.
<Files ~ "\.pdf$">
Header set X-Robots-Tag "noindex, nofollow"
</Files>location ~* \.pdf$ {
add_header X-Robots-Tag "noindex, nofollow" always;
}The always parameter is an addition to Google's snippet. The nginx documentation says add_header without it sets the header only on responses with codes 200, 201, 204, 206, 301, 302, 303, 304, 307 or 308, and inherits add_header directives from an outer level only when the current level defines none. Adding any add_header inside a more specific location block therefore silently drops an X-Robots-Tag set at the server level. Test the live response rather than the config.
The header is rare in the wild. The 2025 Web Almanac found meta robots directives on 47.9% of mobile sites and X-Robots-Tag on 0.7%, and noindex on 2.4% of mobile and 3.5% of desktop sites.
Google says that for the rule to be effective the page "must not be blocked by a robots.txt file." If it is blocked, Googlebot never sees the noindex and the URL can still appear in results when other pages link to it. The robots meta tag reference states it more fully: if robots.txt blocks a URL, "any information about indexing or serving rules will not be found and will therefore be ignored."
Google has to recrawl the page to see the rule, and the documentation warns that revisits can take a long time, so a page may stay in results for a while after you add noindex. Google publishes no figure, and this article does not offer one. What Google does offer is a way to speed it up: request a recrawl with the URL Inspection tool, and watch the Page indexing report in Search Console for pages where Googlebot found a noindex rule. For something that must disappear immediately, the temporary Removals tool covered later is the lever.
Two implementation details can delay or defeat the rule. First, Googlebot fetches up to 2 MB of an HTML file, headers included, and ignores the rest. Google's March 2026 post on Googlebot's byte limits advises placing meta tags, titles, canonicals and structured data higher in the document so they sit well inside that limit. A noindex tag buried after megabytes of inline script is a real, if unusual, failure. The PDF limit in the same post is 64 MB.
Second, a noindex added or removed by JavaScript is unreliable. Google's JavaScript SEO basics say that when Google encounters a noindex tag it may skip rendering and JavaScript execution, and using JavaScript to change or remove the robots meta tag from noindex "may not work as expected." A page that should be indexed needs no noindex in its original HTML, and a page that should be excluded should carry it in the server response or initial HTML.
A disallowed URL is never fetched, so Google has no page content for it, but the URL itself can still be known, from links on other sites or from your own internal links and sitemap. Google's documentation says plainly that a page disallowed in robots.txt "can still be indexed if linked to from other sites," and that when this happens "its URL can still appear in search results, but the search result won't have a description."
Search Console reports the state in two ways in the Page indexing report. "Blocked by robots.txt" means Google could not crawl the URL and may still index it if other information points to it. "Indexed, though blocked by robots.txt" means Google did index it from information on linking pages, with limited snippets. For both, Google gives the same advice: to keep the page out of search, remove the robots.txt block and use noindex; to have it indexed, unblock it.
The 2019 note on unsupported rules adds an expectation worth knowing about. Google wrote that it may index a URL based on links from other pages without seeing its content, and "we aim to make such pages less visible in the future." That is an aim, not a guarantee, and not an invitation to use Disallow for removal.
Most problems fall into a short list, and each item looks reasonable in isolation.
Google announced in October 2014 that its indexing had moved to rendering pages like a modern browser, and wrote that disallowing crawling of JavaScript or CSS "directly harms how well our algorithms render and index your content and can result in suboptimal rankings." The current JavaScript documentation is consistent: Google Search "won't render JavaScript from blocked files or on blocked pages." The robots.txt introduction draws the line the same way: block unimportant scripts, styles or images if the page works without them, and never block resources Google needs to understand the page. Leave asset directories alone, and test any block with the URL Inspection live test.
Google's Removals tool help says not to use robots.txt as a way to block a page, and the permanent options it lists are a 404 or 410 status, password protection, or a noindex tag. A Disallow addition to an already-indexed page does not remove it. The URL can stay in the index while Google loses the ability to refresh it.
This contradiction usually builds in two steps. A page gets a noindex, someone later adds a Disallow to "really" block it, and the noindex can no longer be read. The Web Almanac's own wording applies: "If a page is blocked by robots.txt, its directives may never be seen or obeyed." The fix is to remove the Disallow, let Google recrawl, wait until the URL drops out of the index, and only then decide whether a Disallow is still wanted for crawl-load reasons.
Environment settings travel with deployments. WordPress's "Discourage search engines from indexing this site" setting, per the WordPress reading settings documentation, generates <meta name='robots' content='noindex,nofollow' /> in the head since version 5.3. Before that it served a robots.txt of User-agent: * and Disallow: /. The same page says neither option blocks access to the site and that it is up to search engines to honor the request. A database or settings copy from staging to production can carry the checkbox along, and a whole site then quietly asks to be dropped. No source here catalogs incidents, but the mechanism is documented.
The reverse also happens. A staging site with no noindex and no authentication is indexable. Platforms handle this differently, and the difference matters. Vercel's knowledge base says it adds an X-Robots-Tag: noindex header to every preview deployment automatically, but omits it when a custom domain is assigned to a non-production branch. A team that points staging.example.com at a preview branch has therefore turned off the protection it did not know it had, and has to add the header itself. Authentication is the more robust answer to staging, covered in the worked decisions below.
Google's duplicate-URL consolidation guide says not to use noindex to prevent selection of a canonical page within a single site, "because it will completely block the page from Search," and it recommends rel="canonical" instead. Google's documentation does not walk through every combination of canonical and noindex, so the following is our reading of those two statements. A noindexed page that declares another URL as its canonical sends a mixed message about which URL should carry the content, and a canonical that points at a noindexed URL asks Google to prefer a page that will not be shown. If a URL is a duplicate, canonicalize it. If it should not be in search at all, noindex it and do not also name a canonical elsewhere.
Google's sitemap guidance says to include the URLs you want to see in search results, and to list the canonical version where several URLs show the same content. A sitemap is a statement that these are the pages worth indexing. Filling it with noindexed, redirected or blocked URLs contradicts the page-level instructions and makes Search Console reports harder to read. Generate the sitemap from the same rule that sets noindex, so the two cannot drift.
Rules are prefixes, so a short pattern reaches further than it looks. Disallow: /p blocks /products/, /pricing and /press/. Disallow: /*.php blocks every URL containing .php, including /folder/filename.php?parameters, while Disallow: /*.php$ blocks only URLs that end in it. A Disallow: / left over from a launch blocks everything, and an Allow: / placed in the wrong group does nothing for crawlers that match another group. Run every proposed rule against a list of URLs you do want crawled, not only the ones you want blocked.
A noindexed URL still has to be fetched before Google can read the rule. Google's crawl budget guide says so directly in its list of what not to do: "Don't use noindex" as a way to conserve crawl budget, because Google will still request the page and then drop it. It recommends robots.txt for resources you do not want crawled at all and a 404 or 410 for permanently removed pages. The guide targets sites with over a million unique pages that change weekly, or over 10,000 that change daily, so most sites should choose between the controls on correctness.
Table 4 gives the default for each common situation, and the paragraphs after it cover the cases where the reasoning is less obvious. Where a recommendation rests on our judgment rather than a Google statement, the text says so.
| Situation | Default control | Reason and cautions |
|---|---|---|
| Filter and sort facets with no search value | robots.txt Disallow on the parameter patterns | Google's faceted navigation guide offers this. Keep item pages and one unfiltered listing crawlable. |
| A facet combination people search for | Leave crawlable and indexable, with a canonical to itself and a normal internal link | Blocking it removes a landing page you may want. |
| Internal site search results | robots.txt Disallow on the search path | Google names endless search results as a job only robots.txt can do, since noindex needs a fetch first. |
| Staging and preview environments | HTTP authentication, with noindex as a backup | A Disallow does not stop a linked URL from being listed, and neither rule stops a person holding the link. |
| Thank-you and order confirmation pages | noindex on a crawlable page, or a login or session requirement | Our judgment: the rule states the intent. |
| Cart and checkout | robots.txt Disallow on the path | Google's own robots.txt example blocks /cart. If URLs show up as indexed though blocked, switch those to noindex. |
| PDFs and other files you do not want listed | X-Robots-Tag: noindex header | Do not also Disallow the files. Use authentication if the file is private. |
| Paginated archives | Leave crawlable and indexable | Each page gets its own URL and canonical. Google no longer uses rel="prev" and rel="next". |
| Thin tag pages | noindex, keep crawlable | Our judgment: index only tags with a reason to rank. |
| Tracking parameters | Canonical to the clean URL | Google says not to use robots.txt for canonicalization. |
Google's faceted navigation guide says to use robots.txt if you do not need the filtered URLs in Search or other Google products, because filtered pages often use server resources for little benefit. Its example disallows the parameter patterns and re-allows one specific URL.
user-agent: Googlebot
disallow: /*?*products=
disallow: /*?*color=
disallow: /*?*size=
allow: /*?products=all$The guide adds that canonical and nofollow are generally less effective in the long term for controlling crawl volume. The usual tradeoff applies: blocked facet URLs that earn external links can still be listed without content, so point the links you control at unfiltered URLs.
Google's Robots Refresher gives "endless search results pages" as an example of an action only robots.txt can handle, since the goal is to stop the act of crawling. Disallow the search path (Disallow: /search in the earlier example, or a rule on the query parameter). If search URLs are already indexed, add noindex first, wait for them to drop out, and disallow afterward, since the reverse order leaves the noindex unreadable. That sequence is our inference from the crawlability rule, not a Google recipe.
Put staging behind HTTP authentication or a network allowlist. Google's 2019 post lists password protection as an option that generally removes a page from the index, since the crawler never sees the content. Keep noindex on staging as a second layer, and make the release process verify the opposite on production: no noindex header and no Disallow: /.
A thank-you page gets a noindex because it should never be an entry point, and a crawlable page lets Google read that instruction. Cart and checkout paths generate many session-specific URLs, so a Disallow reduces needless crawling, and Google's Robots Refresher uses disallow: /cart as its example. Watch the Page indexing report after the change. If any of those URLs appear under "Indexed, though blocked by robots.txt," noindex is the correction.
Google's pagination guidance says to give each page a unique URL, not to use the first page as the canonical for the whole sequence, and that Google no longer uses rel="prev" and rel="next". It recommends the noindex robots meta tag for filter and sort-order variations. Page two of a category is often the only route to older items, so blocking it can strand them. The guide also says to link each page to the next with <a href> links, since load-more buttons and infinite scroll rely on JavaScript actions Google's crawlers do not perform.
Verify every robots.txt change and noindex deployment on the live URL, from the outside. The sequence below covers a robots.txt edit; steps 3 to 5 also apply to a noindex change.
curl -s -o /dev/null \
-w '%{http_code} %{content_type} %{size_download} bytes\n' \
https://www.example.com/robots.txtcurl -s -D - -o /dev/null https://www.example.com/files/report.pdfHTTP/2 200
content-type: application/pdf
x-robots-tag: noindex, nofollowcurl -s https://www.example.com/thank-you | grep -io '<meta[^>]*name=.robots.[^>]*>'A GET request that discards the body is more faithful than curl -I, which sends HEAD; some servers and CDNs answer the two differently. The grep shows only the raw HTML, which is the right check for a server-rendered tag and the wrong one for a tag that JavaScript inserts. Use the URL Inspection live test, which shows the rendered HTML and headers Google received, to see a client-side rule. Adding -A "Googlebot" to curl tests how your server treats that user-agent string, but it cannot prove Google reaches the page, because anyone can send that string.
Read the fields together. Google's inspection help notes that when robots.txt blocks crawling, Indexing allowed? can read Yes because Google cannot see a noindex, so a blocked URL showing Yes is a warning, not a pass. When Google has fetched the page and found a noindex, the tool reports that indexing is not allowed. Request indexing is unavailable when the live test shows the page as non-indexable and never guarantees indexing.
The Search Console Removals tool hides a URL from Google Search for a limited time. Google's Removals help says a successful request lasts about six months, and that it works only for properties you own in Search Console. The tool is not a permanent fix. Alongside it, make the removal permanent with a 404 or 410 status, password protection, or a noindex tag. For a page that must come down today, file the temporary request and ship the permanent method in the same change, covering every variation of the URL.
Crawlers from AI companies that honor robots.txt are addressed through the same user-agent groups. Which tokens exist, what blocking each costs you, and how compliance varies are covered in our guide on AI crawlers and robots.txt. The Web Almanac quotes Cloudflare's description of robots.txt as functioning "more as a code of conduct than a command that will always be obeyed," which fits the RFC's statement that the file is not access authorization.
Snippet and preview controls belong to the page-level side. The Robots Refresher notes that not showing a snippet for a page is only possible with page-level elements, and the meta tag reference lists nosnippet, max-snippet, max-image-preview, max-video-preview and unavailable_after. These rules need a crawlable page too. How Google's AI features choose and display content, and which controls apply to them, is covered in our guide on Google's AI features and your site.
This robots.txt reflects the decisions above for a typical shop or content site. Every path is an example to adapt.
# Applies to every crawler without a more specific group
User-agent: *
Disallow: /cart/
Disallow: /checkout/
Disallow: /search
Disallow: /*?*sort=
Disallow: /*?*color=
Disallow: /*?*size=
# Do not block /assets/, /static/, CSS or JavaScript
Sitemap: https://www.example.com/sitemap.xmlPair it with page-level rules: noindex on thank-you pages, thin tag pages and unwanted PDFs, delivered through the template or the X-Robots-Tag header. Keep noindexed paths out of both the robots.txt and the sitemap.
*.Disallow: / reached production.Google's handling of unreachable robots.txt files, caching and blocked URLs would each change a recommendation here, so re-read the robots.txt specification and the block-indexing page when you audit. Both are living documents.
Sources were last checked on October 14, 2026. Documentation changes, so confirm any detail that matters to a decision against the source itself.
Indexive Research. (2026, July 8). What robots.txt and noindex each really control. Indexive AI. https://indexive.ai/research/robots-txt-vs-noindex
Straight answers about how we work. Still have a question? The free audit is the fastest way to get one answered for your site.
No. Google never documented it and retired the handling of unsupported rules, noindex included, on September 1, 2019. Use a robots meta tag or an X-Robots-Tag header on a crawlable page.
A free execution audit: your prioritized backlog, effort estimates, and what we'd ship first. Read-only access, no contract.