Technical SEO and crawler control

What Is Robots.txt? Complete Guide for 2026

Robots.txt is a UTF-8 plain-text file published at the root of a website, such as https://example.com/robots.txt. It tells compliant crawlers which URL paths they may or may not request. It is primarily a crawl-management tool, not a security control or a reliable way to prevent indexing. A correct file can conserve crawl resources and limit low-value URL discovery. A wrong rule can block important pages, rendering assets, search crawlers, or AI search systems.

Updated August 10, 2026SEOS.co Editorial Research
What Is Robots.txt? Complete Guide for 2026

TL;DR

Key Takeaways

  • Robots.txt controls crawler access preferences, not authorization, privacy, or guaranteed removal from search results.
  • The file must be available at /robots.txt for each relevant scheme, host, subdomain, and port.
  • Use Disallow for crawl control, but allow crawling when a search engine must read a noindex directive.
  • Rules are case-sensitive and crawler-specific, and specific user-agent groups can override rather than inherit generic groups.
  • Google supports Allow, Disallow, the * wildcard, and the $ end anchor, but crawler support is not identical across platforms.
  • Test status codes, redirects, rendered resources, parameter patterns, and important URL samples before deployment.
  • Treat AI search crawlers, model-training crawlers, and unidentified scrapers as distinct access and governance decisions.
  • Monitor server logs, crawl reports, indexed URL samples, and robots.txt changes instead of assuming the file is working.

How robots.txt works

The Robots Exclusion Protocol, standardized in RFC 9309, lets a site owner publish crawler access preferences. A crawler retrieves the file, identifies the group that best matches its user-agent token, and evaluates the applicable Allow and Disallow rules before requesting a URL.

Scope is exact. A file at https://www.example.com/robots.txt governs that HTTPS host. It does not automatically govern http://example.com, a different subdomain, or a nonstandard port. Every crawlable host should therefore have an intentional response, even when the intended policy is to allow all crawling.

Robots.txt is voluntary. Reputable search crawlers generally follow it, but malicious bots, scrapers, browsers, and users are not compelled to do so. The file is publicly accessible and can reveal paths that an organization would rather not advertise. Confidential content requires authentication, network controls, or removal from the public server.

Directives, syntax, and matching rules

The core directives are User-agent, Disallow, and Allow. Sitemap declarations are widely recognized, although Sitemap is not part of the core rule matching defined by RFC 9309.

A basic file could contain:

User-agent: *

Disallow: /internal-search/

Disallow: /*?sort=

Allow: /internal-search/help/

Sitemap: https://example.com/sitemap.xml

An empty Disallow value permits crawling. Disallow: / requests that the matching crawler avoid the entire host. Paths are case-sensitive, so /Private/ and /private/ are different. Google supports * as a wildcard and $ as an end anchor. For example, Disallow: /*.pdf$ matches paths ending in .pdf, but not a URL where .pdf is followed by more path text.

When Allow and Disallow rules both match, Google uses the most specific path match. Behavior can differ among crawlers, so avoid clever overlaps when a simpler directory structure or URL rule will work. Comments begin with #. Keep comments operationally useful, but never place credentials or private implementation details in the file.

A specific user-agent group may not inherit rules from User-agent: *. Bing explicitly advises repeating generic directives in specific groups when those restrictions should also apply. Duplicate or conflicting groups should be consolidated where practical.

Choose the right control

The most common robots.txt mistake is using a crawl directive to solve an indexing, canonicalization, privacy, or server-abuse problem. Use this decision matrix before adding a rule.

ObjectivePrimary controlWhyCritical caution
Reduce crawling of infinite filtersRobots.txt plus URL designLimits requests to low-value crawl spacesDo not block filters that have independent search demand
Keep a page out of searchMeta robots noindex or X-Robots-TagThe crawler must read the directiveDo not simultaneously block crawling
Consolidate duplicate URLsRedirects or canonical tagsCommunicates the preferred URL and consolidates signalsA blocked duplicate prevents crawlers from seeing its canonical tag
Protect confidential materialAuthentication and authorizationPrevents unauthorized retrievalRobots.txt is public and voluntary
Remove an obsolete URL404 or 410, with removal tools if urgentProvides an indexable removal signalA Disallow rule can delay recrawling and removal
Slow Bingbot requestsBing crawl controls or crawl-delayBing documents these controlsGoogle does not document support for crawl-delay
Control an abusive scraperWAF, rate limits, or access rulesEnforcement happens at the server edgeConfirm bot identity before blocking shared infrastructure

A URL blocked by robots.txt can still appear in search when a crawler discovers it through links or other sources. The result may have limited information because the crawler could not retrieve the page. If removal is the goal, permit crawling long enough for a supported noindex, 404, or 410 response to be processed.

A safe implementation sequence

  1. Inventory crawl surfaces. List hosts, subdomains, protocols, application paths, parameters, faceted navigation, internal search pages, staging environments, assets, APIs, feeds, and sitemap locations.
  2. Classify URL patterns. Separate valuable indexable pages, necessary crawlable but nonindexable pages, duplicates, infinite spaces, private resources, and assets needed for rendering.
  3. Identify crawler groups. Decide whether major search crawlers, AI search crawlers, model-training crawlers, media bots, and commercial SEO tools need distinct policies.
  4. Write the minimum rules. Prefer a few auditable path patterns over a long collection of fragile exceptions. Repeat shared restrictions in specific crawler groups when inheritance is uncertain.
  5. Test representative URLs. Include uppercase paths, encoded characters, query parameters, trailing slashes, file extensions, locale paths, mobile assets, and both expected matches and expected nonmatches.
  6. Validate delivery. Confirm the file is UTF-8 plain text, reachable at the root, served without authentication, and returning the intended status code and content type.
  7. Deploy with rollback protection. Save the previous version, record the owner and reason, and avoid unreviewed production changes by plugins, deployment templates, or CDN transformations.
  8. Verify behavior. Check crawler testing tools, server logs, crawl statistics, rendered pages, indexed URL samples, and sitemap processing after deployment.

For migrations, launch-day checks should include every old and new host. A copied Disallow: / from a staging environment is one of the most damaging preventable technical SEO failures.

Crawling, indexing, canonicals, and rendering

Crawling is retrieval. Indexing is the search engine’s decision to store and potentially show a resource. Canonicalization is the selection of a representative URL among duplicates. Robots.txt directly addresses only the first process, although crawl restrictions can indirectly affect the other two.

Google explains that a blocked page cannot expose its page-level meta robots directive or an HTTP X-Robots-Tag to Googlebot. The same principle applies to canonical tags embedded in blocked HTML. If a crawler must see a noindex or canonical signal, allow the URL to be fetched.

Do not casually block CSS, JavaScript, images, or API endpoints required to render primary content. A search engine that cannot render the page as a user sees it may misunderstand content, layout, mobile usability, structured data, or links. Test representative templates with rendered HTML and network requests rather than assuming that an asset directory is unimportant.

For faceted navigation, first determine whether a combination represents real search demand. Indexable category and filter pages need stable URLs, unique value, internal links, canonicals, and controlled parameter logic. Combinations that create effectively infinite spaces with little search value may justify robots.txt patterns, link suppression, parameter normalization, or application-level constraints. Robots.txt alone does not consolidate duplicate signals.

Troubleshooting and diagnostic framework

Start with the symptom, then separate discovery, fetch, rendering, indexing, and ranking. An indexing report that says a URL is blocked by robots.txt is not evidence that the URL was removed. A drop in organic traffic after a change also requires template, canonical, redirect, server, and ranking checks.

Five-step diagnosis

  1. Fetch the exact file. Test the affected scheme, hostname, and port. Compare browser, command-line, and crawler-tool responses when a CDN or WAF may vary content.
  2. Record the HTTP outcome. Google processes successful responses, generally treats most 4xx responses as no file, and can temporarily pause crawling after server errors. It may retain the last known good file before eventually treating persistent failures differently.
  3. Resolve the matching group. Identify the actual crawler token and the most specific user-agent group. Then compare the URL path character by character, including capitalization and encoding.
  4. Test signal visibility. Determine whether blocking prevents retrieval of a noindex, canonical, redirect, structured-data payload, or rendering resource.
  5. Confirm in logs. Look for requests to robots.txt, affected URLs, status codes, bot identity, response time, and changes before and after deployment.

Google generally caches robots.txt for up to about 24 hours, although circumstances can alter refresh timing. Allow for caching when evaluating a correction. If the file unexpectedly changes, investigate CMS plugins, edge workers, security products, deployment pipelines, and host-level templates.

Useful KPIs include crawler requests by URL class, percentage of requests reaching indexable pages, response errors, duplicate parameter requests, robots-blocked index reports, time to discover updated pages, rendered-resource failures, and the share of sitemap URLs that are valid and indexable.

Robots.txt for large and complex sites

On a large publisher, marketplace, ecommerce site, or software platform, robots.txt should support crawl prioritization rather than compensate for weak architecture. Build a URL taxonomy from log files and crawl data, then quantify requests, indexability, organic entrances, conversions, update frequency, and server cost for each class.

Prioritize high-value hubs, category pages, product or service pages, current editorial assets, and pages that connect topical clusters. Reduce crawl traps created by calendars, internal search, session IDs, sort orders, print views, repeated filters, and malformed URLs. Strengthen hub-and-spoke internal linking so important pages are discoverable without relying solely on XML sitemaps.

Robots.txt changes should be coordinated with canonical discipline, redirects, sitemap segmentation, navigation rules, content consolidation, and decay remediation. A blocked obsolete page cannot efficiently pass users or signals to its replacement. A blocked duplicate cannot expose its canonical. A blocked orphan remains an architecture problem even if crawler traffic declines.

For ongoing optimization, compare log-file demand with business value. Segment Googlebot, Bingbot, verified AI crawlers, tools, and unidentified agents. Measure whether rule changes increase the proportion of crawling spent on fresh or commercially important URLs. Review rules during migrations, platform releases, international expansion, CDN changes, and major template deployments.

AI crawlers, answer engines, and content access

AI access is not one binary choice. Organizations should distinguish search retrieval, answer citation, model training, user-triggered fetching, and unverified scraping. OpenAI, for example, documents OAI-SearchBot for ChatGPT search visibility and allows publishers to set a separate preference for GPTBot. Blocking GPTBot does not require blocking OAI-SearchBot.

Visibility in Google AI Overviews, AI Mode, Bing or Copilot, and ChatGPT can depend on more than robots.txt. The content must be crawlable by the relevant system, technically retrievable, indexable or otherwise eligible, and clear enough to support extraction. Concise definitions, explicit entity relationships, comparison tables, direct procedures, and source-backed numerical claims improve answer usability, but robots.txt does not guarantee citation or inclusion.

CDN security, WAF policies, CAPTCHA challenges, authentication, geo restrictions, rate limits, and JavaScript challenges can deny access even when robots.txt allows crawling. Conversely, an Allow rule cannot force a scraper to identify itself accurately or obey the protocol. Verify published bot IP or reverse-DNS guidance where available and combine declared preferences with enforceable edge controls when access matters.

A practical policy is to document each crawler’s purpose, owner, access decision, enforcement layer, review date, and observed request volume. Avoid blocking every unfamiliar agent without analyzing discovery or referral value. Also avoid treating an agent name as proof of identity.

What is proven, accepted, and still uncertain

Proven by standards or official documentation

  • Robots.txt is a public, host-scoped crawl-preference file, not access authorization.
  • Blocking crawling does not guarantee deindexing.
  • Google must crawl a URL to read its meta robots or X-Robots-Tag directive.
  • Major crawlers differ in supported directives and operational behavior.

Strong practitioner consensus

  • Short, pattern-based files are safer than long collections of overlapping rules.
  • Log-file analysis is more reliable than inferring crawler behavior from rankings alone.
  • Staging protection should use authentication, with robots.txt only as an additional signal.
  • Robots.txt changes need version control, ownership, testing, and rollback procedures.

Still uncertain or crawler-dependent

  • How consistently every AI crawler checks or obeys robots.txt.
  • How much allowing a specific AI crawler increases citation or answer-engine visibility.
  • How unidentified or spoofed bots interpret wildcard patterns and specific groups.

A May 2025 Duke and arXiv study found that stricter directives correlated with lower scraper compliance and reported that AI search crawlers often checked robots.txt infrequently. This supports enforcement through WAF and server controls, but it does not prove that every named AI product behaves the same way.

Separate COLM 2025 research found near-zero general-knowledge degradation in tested 1.5B models after filtering robots.txt opt-outs, while domain-specific biomedical performance declined when major publishers were excluded. That finding concerns model training experiments, not whether an individual website will receive traffic or citations.

Community reports describe plugins overwriting files, Cloudflare settings conflicting with declared rules, and AI crawlers behaving differently. These observations are useful troubleshooting leads, not controlled evidence. Reproduce the issue with logs and exact responses before drawing conclusions.

Governance, tools, and when to seek help

A small brochure site can usually manage robots.txt with a text editor, crawler tester, Search Console, Bing Webmaster Tools, and server logs. Larger sites benefit from automated regression tests that compare important URL samples against expected crawler outcomes during every deployment.

Use a specialist when rules span many hosts, faceted navigation generates millions of URLs, organic performance changed after a migration, bot traffic threatens infrastructure, or legal and commercial teams need separate AI access policies. The engagement should produce a crawl map, rule rationale, tested samples, log baseline, deployment plan, rollback file, and post-launch measurement schedule.

Review the file at least during major releases and quarterly on dynamic sites. Remove obsolete directives, verify sitemaps, test priority templates, and compare crawl distribution over time. The goal is not the fewest crawler requests. It is efficient discovery and refresh of valuable content without exposing private resources or wasting infrastructure on uncontrolled URL spaces.

FREQUENTLY ASKED QUESTIONS

SEO Questions Answered

Where should robots.txt be located?

Place it at the root of the exact scheme and host it governs, such as https://example.com/robots.txt. A file in a subdirectory has no robots.txt authority. Separate subdomains and ports need their own files.

Can robots.txt prevent a page from appearing in Google?

Not reliably. A blocked URL can still be discovered through links and appear without a useful snippet. To prevent indexing, allow crawling and use noindex, or return an appropriate 404 or 410 response when the content is gone.

Is robots.txt a security feature?

No. It is public and voluntary. Use authentication, authorization, network restrictions, WAF policies, or server configuration to protect confidential resources.

What does User-agent: * mean?

It defines a group intended for crawlers that do not match a more specific user-agent group. Do not assume its directives are inherited by a specifically named group. Repeat necessary shared rules when crawler documentation recommends it.

Should CSS and JavaScript files be blocked?

Usually not when they are required to render important page content, navigation, structured data, or mobile layouts. Test rendered pages and required network requests before blocking asset directories.

Does Google support crawl-delay?

Google does not document crawl-delay as a supported robots.txt directive. Bing supports it, although Bing also provides crawl-control tools. Server problems should be addressed through capacity, caching, rate management, and crawler-specific controls.

Should XML sitemaps be listed in robots.txt?

They can be. Sitemap declarations are widely supported and help crawlers locate sitemap files. They do not replace submitting and monitoring sitemaps in search-engine webmaster platforms.

How long does a robots.txt change take to work?

It depends on when each crawler refetches the file. Google says it generally caches robots.txt for up to about 24 hours, although cache duration can vary. Confirm the new response and monitor logs rather than relying on immediate visual checks.

Should AI crawlers be allowed?

Decide by crawler purpose. Search retrieval and answer visibility may have different agents from model training. Document the expected benefit, data policy, enforcement method, and observed traffic for each agent instead of applying one rule to every AI system.

Can robots.txt fix duplicate content?

It can reduce crawling of some duplicate patterns, but it does not consolidate ranking signals. Use redirects, canonical tags, controlled internal links, parameter handling, and sitemap discipline to manage duplication.

RESEARCH SOURCES

Sources and Verification

  1. RFC Editor, RFC 9309: Robots Exclusion ProtocolPrimary standard defining the protocol, file location, encoding, groups, matching, and voluntary compliance model.
  2. Google Crawling Infrastructure, Robots.txt SpecificationsOfficial documentation for Google rule matching, wildcards, status-code handling, caching, and parser behavior.
  3. Bing Webmaster Help, How to Create a Robots.txt FileOfficial Bing guidance covering crawler groups, testing, crawl-delay, and repetition of generic directives.
  4. OpenAI, Guidance for Allowing OpenAI Web CrawlersPrimary documentation distinguishing OAI-SearchBot from GPTBot and describing other access barriers.
  5. Cloudflare, AI Crawl Control Bot ReferenceTechnical reference for AI crawler identities and combining declared preferences with edge enforcement.
  6. Duke Scholars, Crawler Compliance ResearchUniversity record for May 2025 large-scale research into robots.txt compliance and scraper behavior.
  7. arXiv, Robots.txt Compliance StudyResearch preprint reporting differences in crawler checking and compliance, including AI-related crawler behavior.
  8. University of Chicago, Web Crawler Measurement ResearchAcademic project page for internet-scale measurement of crawler behavior.
  9. OpenReview, Robots.txt Opt-Out Filtering StudyCOLM 2025 research on general and domain-specific model effects after filtering publisher opt-outs.
  10. Proceedings of Machine Learning Research, Mirchandani et al.Peer-reviewed machine-learning proceedings relevant to data governance and model-training evidence.
  11. HPLT Project, Common Crawl 2025 Data Transfer ReportDataset-oriented source documenting web-scale Common Crawl data handling and research context.
  12. ScienceDirect, Robots.txt Research ArticleIndependent scholarly publication relevant to robots.txt, web data access, and crawler governance.
  13. Semrush, Beginner's Guide to Robots.txtPractitioner reference for common implementation patterns, examples, and SEO troubleshooting.
  14. Windows Central, Cloudflare Robots.txt Update CoverageIndependent reporting on the evolving relationship between Cloudflare controls, robots.txt, and AI crawlers.
  15. Reddit TechSEO Community DiscussionCurrent practitioner discussion included only as anecdotal context for implementation and crawler-behavior issues.
  16. Research sourceConsulted during live web research for this page.
  17. Research sourceConsulted during live web research for this page.
  18. Google Search Central, Introduction to Robots.txtOfficial guidance on appropriate crawl-management uses and why robots.txt should not be used to hide pages.
  19. Research sourceConsulted during live web research for this page.
  20. Research sourceConsulted during live web research for this page.

SEOS.CO EXPERT MATCH

Ready to Find the SEO Partner That Can Win Your Market?

Tell us your market, goals and growth targets. SEOS.co will help narrow the field and connect you with a serious SEO partner built for the opportunity.

Research-backed guidanceBuilt around your marketNo canned shortlist
Get My Free SEO Agency RecommendationTell us what you need. We will help narrow the field.