Robots.txt – What It Is, How the Format Works and Who Actually Follows It
A complete guide to robots.txt: what it is, how the format and rules work, how Google and other crawlers interpret it, how widely it is used, how AI crawlers are changing the picture, and how to write and test a file for your site.

Every website has visitors that never read a word. They are programs, usually called crawlers, bots or spiders, and they arrive all day and all night to read pages, follow links, copy content and report back to search engines, price comparison sites, analytics tools, security scanners and, increasingly, artificial intelligence companies. For more than thirty years, the web has relied on one very small file to tell these automated visitors how a site would like them to behave. That file is called robots.txt. It is a plain text document placed at the top level of a website, it is among the simplest things a webmaster ever writes, and it is one of the most misunderstood. People treat it as a security lock, an SEO switch or a legal barrier, and it is none of those. This article explains what robots.txt really is, where it came from, how the format and the matching rules work, how it is used across the web, what happened when AI companies began crawling at massive scale, where it fails, how it is being extended, and how to write, test and maintain a sensible file for your own site. It is written for website owners, developers, marketers and students, and each technical term is explained when it first appears. Standards and company policies change, so check the official documents and the latest research before making important decisions.
Where robots.txt came from
In the early 1990s, the web was small and its servers were weak. A badly written crawler could hammer a site with so many requests that it slowed to a crawl or fell over. In 1994, a software engineer named Martijn Koster proposed a simple convention: a site owner places a text file at a fixed address, and well behaved robots read it before crawling and avoid the places the owner marks as off limits. The idea spread because it was easy and because everyone, from site owners to search engine builders, benefited from a shared rule of politeness. The document that finally formalised it, RFC 9309, was published in September 2022 as a proposed standard by the Internet Engineering Task Force. It lists Koster among its authors together with Gary Illyes, Henner Zeller and Lizzi Sassman, and its abstract says that it specifies and extends the method originally defined by Koster in 1994, noting that it may be inconvenient for service owners if crawlers visit the entirety of their address space.
That history carries an important message. Robots.txt was designed as a request for good behaviour, not as an enforcement mechanism. RFC 9309 says so plainly: the rules it describes are not a form of access authorisation. A polite crawler reads the file and obeys it. An impolite one can ignore it, and nothing in the protocol stops it.
What robots.txt is, and what it is not
Put simply, robots.txt is a plain text file named robots.txt, located at the root of a host, such as https://example.com/robots.txt. It contains groups of rules. Each group names one or more crawlers, using a label called a user agent, and then lists the paths on the site that those crawlers may or may not fetch. A crawler arriving at your site is expected to fetch this file first, find the group that applies to it, and follow the rules in that group.
Several clarifications prevent common mistakes. First, robots.txt controls crawling, meaning whether a bot may fetch a page, and not indexing, meaning whether a search engine may list a page in its results. Google’s documentation notes that the rules in the file apply only to the host, protocol and port number on which the file is hosted, and crawlers do not look for robots.txt files in subdirectories. If other sites link to a page that you have blocked, a search engine may still show the web address in results without a description, because it knows the page exists even though it cannot read it. To keep a page out of search results, the usual tools are a noindex instruction in the page itself or in an HTTP header, or password protection, and for that instruction to work the crawler must be allowed to fetch the page and see it. Second, robots.txt is not security. The file is public, anyone can read it, and listing a private folder in it effectively announces where that folder is. Truly private material should be protected with logins and server rules, not with a polite request. Third, it is not a copyright notice or a contract, although it can serve as evidence of your preferences.
The format, step by step
The file is made of lines, each containing a field name, a colon and a value. Lines starting with a hash sign are comments for human readers. Groups are separated by blank lines, although parsers are generally lenient. The main elements are as follows.
The user agent line
Every group begins with one or more lines of the form user-agent followed by the name of the crawler it applies to. The name is a short label, called a product token, such as Googlebot or Bingbot. The matching of crawler names is not case sensitive. The value of a single asterisk is a wildcard meaning every crawler not matched by a more specific group. If a crawler finds a group that names it, it follows that group and ignores the wildcard group. RFC 9309 also says that if more than one group matches a crawler, the rules of the matching groups are combined into one.
Disallow and allow lines
Under the user agent line come rules. A disallow line gives a path that the crawler should not fetch, and an allow line gives a path that it may fetch. The matching is based on the beginning of the path, so disallow followed by /private/ blocks everything whose path starts with that text. An empty disallow value means nothing is blocked. The RFC specifies that paths in allow and disallow rules are matched case sensitively, starting from the first character of the path, so /Photos/ and /photos/ are different. When more than one rule matches a URL, the most specific match is used, and the most specific match is the one with the most characters. If no rule matches, or the group has no rules, the URL is allowed, and the robots.txt address itself is implicitly allowed. This longest match rule is why an allow line for a specific page can override a broader disallow for the folder that contains it.
Special characters
Two special characters give the paths extra power. An asterisk inside a path matches any sequence of characters, and a dollar sign at the end of a path anchors the match to the end of the address. For example, a rule using disallow and a path ending in .pdf with a dollar sign blocks addresses that end with .pdf, while an asterisk can match query strings such as every address containing a given parameter. Characters that are special in addresses should be percent encoded, according to the RFC.
The sitemap line
A line giving the full address of an XML sitemap, the list of pages you want crawled, is not part of the core protocol but is almost universally understood. The RFC allows crawlers to interpret other records that are not part of the protocol, with Sitemaps given as an example, and to be lenient when reading them, for instance by accepting common misspellings. Sitemap lines are not tied to a user agent group and may appear anywhere in the file.
Fields that some crawlers use and others ignore
Other lines appear in the wild. The crawl-delay line asks a crawler to wait a given number of seconds between requests, and some crawlers honour it, but Google does not support it. Older conventions such as noindex lines inside robots.txt are no longer supported by Google. Because support varies, treat any field beyond user-agent, allow, disallow and sitemap as a hint rather than a guarantee, and check each crawler’s own documentation.
A worked example
The following small file is for an imaginary Accra online shop. It shows comments, a wildcard group, a specific group, longest match behaviour and a sitemap line.
text
# robots.txt for https://shop.example.com
User-agent: *
Disallow: /cart/
Disallow: /checkout/
Disallow: /account/
Disallow: /search?
Allow: /account/help/
User-agent: GPTBot
User-agent: CCBot
Disallow: /
Sitemap: https://shop.example.com/sitemap.xml
In this example, ordinary crawlers may visit the site but are asked to stay out of the cart, checkout, account and internal search pages, with an exception for a help section inside the account folder, because the longer allow rule is the most specific match. Two named AI related crawlers are asked to stay out altogether. The sitemap line tells search engines where to find the list of pages. The groups for GPTBot and CCBot share one set of rules because the two user agent lines sit together before the shared rule.

How crawlers fetch and treat the file
How a crawler obtains and caches the file matters as much as what it says. RFC 9309 describes a few rules, and Google’s documentation explains its own behaviour in detail.
The file must be at the root of each host. A subdomain such as blog.example.com needs its own file, as does each protocol and port. If the request for the file is redirected, the crawler should follow at least five consecutive redirects, and Google follows at least five hops and then treats the result as not found. If the file downloads successfully, the crawler must follow the rules it can parse. If the server returns a client error in the 400 range, which includes a missing file, crawlers generally treat the situation as having no restrictions, and Google treats all such errors except a 429, which means too many requests, as if a valid file did not exist and assumes no crawl restrictions. The behaviour for server errors in the 500 range is the opposite, cautious, rule: the RFC says that crawlers should assume complete disallow, and Google, for example, stops crawling a site for the first 12 hours of a server error while it keeps trying to fetch the file. This asymmetry deserves attention, because a site whose robots.txt address is broken by a server fault can find that crawling stops, while a site whose file is simply missing is open to everything.
Caching also matters. Google generally caches the file for up to 24 hours, and may cache it longer when it cannot refresh it, so a change you make may take a day to take effect. As for size, Google enforces a limit of 500 kibibytes and ignores any content beyond it, which is a good reason to keep files tidy and to consolidate rules. If a server returns an HTML page instead of rules, Google will try to parse it and extract rules, ignoring everything else, though you should not rely on that leniency.
How widely it is used
Robots.txt is one of the most widely adopted conventions on the web. The 2025 Web Almanac from HTTP Archive found that about 94.1 percent of roughly 12.9 million sites analysed include a robots.txt file with at least one directive, which echoes an analysis of a July 2025 crawl that found 12,155,217 of the sites it checked served the file and 5.88 percent did not. The wildcard user agent appears in 97.4 percent of the files, which shows that most sites simply write general rules. A large share of files are generated by content management systems, hosting platforms and plugins, so many site owners have a file without ever writing one.
The more interesting change has been the arrival of lines aimed at artificial intelligence crawlers. According to the Web Almanac, GPTBot, the crawler that OpenAI uses to collect training data, was named in the robots.txt of about 4.5 percent of desktop sites in 2025, up from about 2.9 percent a year earlier, a rise of roughly 55 percent, although the Almanac’s own text cites slightly different base figures in places. The share rises sharply on popular sites: an analysis of the July 2025 crawl found that GPTBot appears in the rules of 20.9 percent of the top 1,000 sites, 12.1 percent of the top 10,000, 6.1 percent of the top 100,000 and 3.6 percent of the top million. Cloudflare Radar’s June 2025 data found that about 14 percent of top domains, 546 of 3,816 with a readable file, had directives specifically targeting AI bots, with disallow rules far more common than allow rules, and with GPTBot the most blocked bot and also the one most often explicitly allowed. Counts of sites blocking GPTBot passed 5.6 million in late 2025, up from 3.3 million in July 2025, according to a report on publisher behaviour, and one survey of leading news sites found nearly half were blocking OpenAI by the end of 2023.
Studies of specific samples in 2026 give consistent but varied pictures. A check of 1,069 popular sites found that about one in five blocks the big training crawlers, with GPTBot blocked on 19.7 percent, ClaudeBot on 18.8 percent and CCBot on 20.7 percent, and that 7.2 percent already use the new content signal directive that we discuss below. A September 2026 check of the top 1,000 sites found that 12.3 percent block GPTBot by name and 20.2 percent mention it. A tracker of the top 1,000 reports a plateau around a quarter blocking GPTBot, with about 30 percent adopting a middle path that blocks training crawlers while allowing search related ones, though that is a smaller and less rigorous source. The numbers differ because the samples differ, so the safest summary is that blocking AI training crawlers is common among large, well known sites, much less common among smaller ones, and growing.
The AI crawler era and the compliance problem
When AI companies began collecting web content on a large scale, robots.txt became a front line in a dispute about permission. Publishers wanted a simple way to say that their pages could be indexed by search engines but not used to train commercial AI models, and robots.txt, with its established user agent mechanism, was the obvious place. Companies responded by publishing the names of their crawlers so that site owners could address them, and the practice of naming training crawlers, search crawlers and user triggered fetchers separately emerged.
It helps to understand the three categories. Training crawlers, such as GPTBot, CCBot, ClaudeBot and the product token Google-Extended, gather content to build or improve models. Search or retrieval crawlers, such as OpenAI’s search bot and Perplexity’s bot, index pages so that AI search tools can cite them. User triggered fetchers, such as ChatGPT-User, fetch a specific page when a person asks an assistant about it. Google’s token Google-Extended works as a control in robots.txt for certain AI uses of content and, as Google describes it, does not affect ranking in ordinary search. A site owner can choose different rules for each category, and a common middle path is to block the training crawlers while allowing search and retrieval ones, so that the site can still be found and cited.
The hard question is whether the rules are obeyed. The evidence is uneven. Studies by TollBit, a company that monitors bot traffic and sells licensing tools, report that the share of bot scrapes ignoring robots.txt has grown. It said that bypasses rose from 3.3 percent to 12.9 percent of scrapes in one quarter of early 2025, that 13.26 percent of requests across all AI bots ignored directives in the second quarter of 2025, and that about 30 percent of total AI bot scrapes in the fourth quarter of 2025 bypassed explicit permissions, with the retrieval agent ChatGPT-User accounting for the highest rate at 42 percent of its scrapes accessing sites that had blocked it. In the first half of 2026, TollBit reported that about 15 percent of identified AI page fetchers across the European sites it studied reached URLs marked disallowed, and that ChatGPT-User reached disallowed pages on nearly half of the European sites that had explicitly blocked it. TollBit counts any request to a disallowed address as a bypass, regardless of what the operator says about intent, and it is a company with a commercial interest in the topic, so its figures should be read with that in mind.
The companies’ own positions explain part of the gap. Reports note that OpenAI removed robots.txt compliance language for ChatGPT-User from its crawler documentation on 9 December 2025, and that Google added Google-Agent to its list of user triggered fetchers on 20 March 2026, documenting that such fetchers generally ignore robots.txt because a person asked for the page. The reasoning is that a fetch made on behalf of a human is more like the human’s own browser than a crawler. Critics respond that this makes robots.txt useless against exactly the kind of traffic that publishers worry about. Academic research adds nuance. A large study of scraper compliance using web logs found that bots are less likely to comply as directives become stricter, that certain categories of bots, including AI search crawlers, rarely check robots.txt at all, and that some apparent non compliance comes from spoofing, where malicious bots present a false user agent to avoid detection. There have also been allegations, reported by Wired and others, that at least one AI search company bypassed blocks, which the company has disputed in public statements that I have not verified here.
The practical lesson is that robots.txt works well against crawlers that choose to be polite, including all the major search engines, and works poorly against those that do not. Site owners who need real protection use additional measures at the server or network level, such as rate limiting, bot detection services, authentication, paywalls and, in some cases, licensing arrangements. Cloudflare and others offer tools that block or charge AI crawlers at the network edge, and these do not depend on the crawler’s goodwill.
How the standard is evolving
Because robots.txt can say only whether a crawler may fetch a path, it cannot express more subtle wishes such as allowing search indexing but not AI training, or allowing use for answering questions but not for model training. Several efforts aim to extend it. The Internet Engineering Task Force has an AI Preferences working group, known as aipref, which is developing a shared vocabulary for expressing how content may be used, and a mechanism for attaching those preferences to content through robots.txt and HTTP headers. One draft of the vocabulary reached its eighth revision on 14 September 2026, and the draft that defines how preferences bind to content lapsed in mid 2026 and was reposted, so the work is still in progress and details may change before any final publication.
Alongside the formal process, Cloudflare has deployed what it calls content signals, a robots.txt extension that adds lines such as content-signal with values for search, ai-input and ai-train, which a site can set to yes or no, with different settings for different crawlers if it wishes. A document on the topic notes that the extension has been deployed at scale on millions of domains, and some validators check for it, though major model providers have only signalled possible future support. Another draft proposes policy tokens inside robots.txt that bind preferences such as no AI training to paths using ordinary groups, and an individual submission proposes a separate file called ai.txt for richer licensing and policy declarations. None of these is a settled standard, and a signal is only as effective as the willingness of crawlers to honour it, but they show where the field is heading: from a simple allow or deny rule toward a vocabulary of permitted uses.
How robots.txt differs from its newer relatives
It is worth placing robots.txt next to the other files and signals that sites use. The sitemap lists the pages you want search engines to find, and it is an invitation. The robots.txt file lists places crawlers should avoid, and it is a request. The meta robots tag and the X-Robots-Tag header give instructions about indexing and snippets for a specific page or file, and they work only if the crawler is allowed to fetch the page. The llms.txt file, which I covered in a separate article, is a curated guide for AI systems and agents and has no access control function. Together they form layers: a sitemap to point, robots.txt to ask crawlers to stay away from low value or sensitive areas, page level directives to control indexing, and server level protections to enforce what matters.
How to write a good robots.txt
A good file is short, clear and tied to a purpose. Begin by asking what you actually want. The most common legitimate goals are saving crawl effort on large sites by keeping crawlers out of endless low value pages such as internal search results, filtered product lists, shopping carts and login pages, keeping crawlers out of staging or administrative areas, pointing crawlers to your sitemap, and stating your preferences for AI crawlers.
Write one group per audience. Use the wildcard group for general rules, and add specific groups for crawlers you want to treat differently. Keep related rules together, put the more specific allow exceptions where they make sense, and remember that the longest matching rule wins. Use comments to explain the reasons for each rule, since you or a colleague will not remember them later. Always include the sitemap line. Avoid blocking the resources that pages need to display properly, such as stylesheets and scripts, because search engines often need them to understand a page, and blocking them can harm how a page is evaluated. Keep the file under the size limit. And never use it to hide things you would be embarrassed to have found.
If you run a content management system, check what it does for you. WordPress, for instance, produces a virtual robots.txt by default, and plugins can edit it. Hosted builders such as Wix and Squarespace manage the file with limited options, so check what your platform lets you change. If you use a content delivery network or a security service, check whether it injects its own rules or blocks bots at the edge, which may override or duplicate your file.
Testing and maintenance
Test before and after you publish. Open the address in a browser to confirm that it returns plain text with a successful status code and not an HTML error page. Use the robots.txt report in Google Search Console, which shows the file Google found, when it last fetched it and any parsing problems, and use a testing tool to see whether specific URLs are allowed or blocked for a given crawler. Check your server logs to confirm which crawlers actually visit and which paths they fetch, since logs reveal behaviour that the file cannot. Review the file whenever you change your site structure, launch a new section, move to a new platform or change your policy on AI crawlers, and keep it under version control so you can restore a previous version if something goes wrong.
Common mistakes
A short list of errors accounts for most robots.txt disasters. The worst is leaving a blanket disallow of the entire site in place after a staging or development phase, which can remove a live site from search results over time. Another is placing the file in a subfolder or on the wrong subdomain, so crawlers never find it. A third is relying on the file to hide private pages, which advertises them instead. A fourth is blocking a page with robots.txt and expecting a noindex tag on it to work, when the crawler can never read the tag. A fifth is blocking stylesheets and scripts. A sixth is forgetting that paths are case sensitive and that trailing slashes matter. A seventh is an overly long or messy file with contradictory rules, which different crawlers may interpret differently. An eighth is assuming that a change takes effect instantly, when caches can delay it by a day or more. A ninth is copying someone else’s file without understanding it, which may block pages you want to rank. And a tenth is treating the file as a legal shield, when it is a request that some crawlers will ignore.
Robots.txt and the choices facing site owners
The AI era forces a strategic choice that robots.txt cannot make for you. Blocking training crawlers may protect your content from being used to build commercial models without payment, but it will not necessarily stop other uses, and it may do nothing against crawlers that ignore it. Blocking search and retrieval crawlers may make your site invisible in AI answers, which could cost you traffic and customers. Allowing everything maximises exposure but gives away your content freely. There is no universally right answer. Publishers with valuable, subscription based content tend to block more, businesses that want to be found tend to allow more, and many choose the middle path described above. Whatever you decide, write the decision down, apply it consistently, and revisit it as the market and the standards change.
What this means for Ghana and Africa
For Ghanaian and African site owners, robots.txt matters in practical ways. Many local sites run on shared hosting or modest servers with limited bandwidth, and unrestricted crawling by aggressive bots can slow a site or increase hosting costs, so sensible rules can help. Newsrooms, universities, government portals and online shops that produce valuable local content have a stake in how AI systems use it, especially because African languages and local news are underrepresented online, and decisions about access may influence how well AI tools understand and represent local realities. Small businesses should make sure that their file does not accidentally block search engines, since being found on search and maps is how most customers will reach them. Site owners using website builders should check what controls they have. And anyone who runs an African news or media site should weigh the value of AI visibility against the risks of uncompensated use, and consider network level tools if robots.txt alone proves insufficient.
Final thoughts
Robots.txt is the web’s oldest piece of machine etiquette, a small text file that says please do not go there. Its format is simple: groups of rules naming crawlers, with allow and disallow lines that match the start of a path, wildcard characters for flexibility, a sitemap line for convenience, and the longest match principle for settling conflicts. The standard was finally written down as RFC 9309 in 2022, nearly thirty years after the idea began, and it remains almost universal, present on about 94 percent of the sites measured in recent surveys. Its strengths are simplicity and near universal respect among the major search engines. Its limits are just as clear. It cannot enforce anything, it can be ignored, it is public, and it says nothing about what a crawler may do with content once it has been fetched.
The rise of AI crawlers has put those limits under pressure, with measurements showing a meaningful and growing share of AI related requests reaching pages that sites had asked them to avoid, especially from agents acting on behalf of users, and with new proposals such as content signals and the IETF’s AI preferences work trying to give site owners a richer vocabulary. For now, the best approach is to use robots.txt for what it does well, steering polite crawlers and stating your preferences, to protect what truly matters with real access controls, and to keep your file simple, tested and current. Standards and company policies change, so check RFC 9309, the documentation of each crawler you care about and the latest research before you rely on any detail.












