How to block bots on your website: what each method stops, and what gets past it
robots.txt only asks crawlers to stay away. Blocking bots that ignore it takes verified crawler lists, edge rules, and checks on the network, device and behaviour behind each request.

9 min read

Blocking bots means refusing requests from software you do not want on your site: scrapers, credential-stuffing tools, scalpers' checkout scripts, spam bots and, if you choose, AI crawlers. It does not mean blocking all automation. Search engines, uptime monitors and some AI assistants are bots you want, and bad bots made up 37% of all internet traffic in 2024 according to Imperva's 2025 Bad Bot Report, so the job is sorting the two rather than shutting the door.
This guide goes through the usual methods in order of effort, says what each one stops, and explains what gets past it.
| Method | What it stops | What gets past it |
|---|---|---|
| robots.txt | Search engines and AI crawlers that choose to follow it | Any bot that ignores it |
| Verifying crawlers by published IP list | Scrapers using a well-known crawler's name | Bots that do not claim to be a crawler |
| Rate limits and WAF rules | High-volume bots from a few addresses, malformed requests | Bots spread across residential proxies that copy a real browser |
| CAPTCHA on forms | Automated form spam, and solving services if the CAPTCHA checks who solved it | Anything that never loads the form, such as scrapers and API scripts |
| Detection at the edge | Bots in real or modified browsers, on pages and APIs | Very little consistently, because it has to fake the network, device and behaviour all at once |
Decide which bots you want first
Every blocking decision depends on this list, so write it down before changing anything.
| Bot type | Examples | What blocking it does |
|---|---|---|
| Search engine crawlers | Googlebot, Bingbot | Removes you from search results |
| AI training crawlers | GPTBot, ClaudeBot, CCBot | Keeps your content out of model training; a business decision |
| AI search and assistant fetchers | OAI-SearchBot, ChatGPT-User, Claude-User, PerplexityBot | Stops those assistants finding and citing you |
| Services you use | Uptime monitors, payment callbacks, partner integrations | Breaks the service |
| Everything else that is automated | Scrapers, credential-stuffing tools, spam bots, checkout scripts | What you want to block |
How to detect AI agents lists the main AI crawlers and agents and how to verify each.
robots.txt asks crawlers to stay away, but does not block them
A robots.txt file at the root of your site tells crawlers which paths they may fetch. The crawlers that follow it are the ones run by companies with a reputation to keep: search engines and the main AI companies. To ask the main AI training crawlers to stay away from your whole site:
User-agent: GPTBot
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: CCBot
Disallow: /
User-agent: Google-Extended
Disallow: /Google-Extended is a token rather than a crawler: Google reads it to decide whether pages Googlebot fetched may be used for Gemini, so disallowing it does not affect search. Our own logs show AI crawlers read robots.txt far more often than any other file meant for them, as our llms.txt study found.
robots.txt does nothing against a bot that chooses to ignore it, and the bots you most want to stop are exactly those. It is the polite first step, not a defence.
Verify any crawler you allow
A user agent is a line of text the client chooses, so a scraper can call itself Googlebot or GPTBot. Before you allow a crawler by name, confirm the request really comes from its operator:
| Operator | Crawlers | How to verify |
|---|---|---|
| Googlebot | Reverse DNS lookup on the requesting IP address, as Google documents | |
| Microsoft | Bingbot | Reverse DNS lookup on the requesting IP address, as Bing documents |
| OpenAI | GPTBot, OAI-SearchBot, ChatGPT-User | Published IP ranges, for example openai.com/gptbot.json |
| Anthropic | ClaudeBot, Claude-SearchBot, Claude-User | Published IP ranges at claude.com/crawling/bots.json |
| Perplexity | PerplexityBot, Perplexity-User | Published IP ranges, for example perplexity.ai/perplexitybot.json |
Allow requests whose name and address both match, and block any that use a crawler's name from an address outside its list. Borrowing a well-known crawler's name is common: between 5 and 18 October 2026, 53% of the 17,935 requests to prosopo.io that carried an AI crawler's user agent came from addresses that did not belong to the company named, as how to detect AI agents sets out.
AI agents that browse on a person's behalf, such as ChatGPT Agent, are harder, because many run a real browser from addresses that no published list covers. How they behave on the page is a better guide than where they connect from. An independent study of scroll behaviour, which was discussed on Hacker News, measured how bursty the scrolling of people and AI browsing agents was in the public dataset from the FP-Agent paper. People scrolled in bursts and agents did not, and a model using scroll timing alone told them apart 73.4% of the time, confusing people mainly with ChatGPT Agent. Scrolling on its own is not enough, but it shows why behaviour belongs in the decision.
Server, WAF and CDN rules stop the obvious traffic
Rules on your web server, web application firewall or CDN refuse requests before your application handles them.
| Rule | What it does | What gets past it |
|---|---|---|
| Rate limits | Caps how many requests one address, session or account makes in a period, set per endpoint so a login form can be stricter than a product page | Bots spread across thousands of residential proxy addresses, each staying under the limit |
| Address and network blocks | Refuses hosting providers, known VPN and proxy exits, or countries you do not serve | Residential and mobile proxies; real people on shared networks are caught by mistake |
| Request rules | Refuses malformed requests, missing headers and paths no real visitor uses | Bots that copy a real browser's headers |
These are cheap and worth having, but they work on things an attacker controls, so check what a rule would catch before you enforce it.
A CAPTCHA protects your forms, and a good one spots solving services
A CAPTCHA checks each visitor before a form is accepted, and a modern one lets most real visitors through without showing them a puzzle. It stops most automated form spam on its own. Attackers going after logins, sign-ups and checkouts sometimes pay CAPTCHA solving services to pass the challenge for them using people or software, so a CAPTCHA that only checks whether the challenge was answered can be beaten. A CAPTCHA that also checks who solved it can catch them, because solving services leave traces:
| Trace | Why it shows up |
|---|---|
| Proxies and relayed connections | The challenge is solved on a worker's device and the answer is used from the bot's own connection, often through a proxy, so where it was solved and where the form is submitted do not match |
| Timing | Sending a challenge out to a service and back takes a different amount of time, with a different rhythm, from a person filling in the form themselves |
| Repeated devices | Workers solve challenges for many sites from the same devices, so one device appearing across unrelated sites and sessions stands out |
Proof-of-work challenges add a cost to each attempt and work best alongside these checks.
A CAPTCHA protects the forms it is placed on. Scrapers and scripts that call your API directly never load a form, so those routes need checks at the edge as well.
What serious bot detection looks at
Bots that get past the methods above usually run a real browser engine, often a commercial anti-detect browser that has been modified to remove the traces automation normally leaves, and they connect through residential or mobile addresses. Telling them apart from customers takes evidence from several layers at once:
| Evidence | What it shows | How hard it is to fake |
|---|---|---|
| The network connection | How the connection and its encryption were set up, which is characteristic of the software and operating system that opened it | Hard, because it has to match everything else the client claims |
| The address behind it | Home broadband, mobile, business, hosting, VPN, proxy or Tor, and what the address has done before | Easy to rotate with residential proxies |
| The request headers | Whether the headers agree with each other and with the claimed browser | Easy to copy from a real browser |
| The browser and device | Whether the claimed browser and platform have the features of that version, and whether text and graphics render as the claimed hardware would | Moderate; anti-detect browsers edit much of it |
| The hardware underneath | Timing measurements that differ between consumer devices and servers, virtual machines or containers | Hard, because a browser cannot change how fast its processor runs |
| Traces of remote control | Changes that automation and remote-control tools make to the page environment | Moderate; tools built to hide them remove many |
| Behaviour | The timing, rhythm and order of mouse, touch, keyboard and scroll input | Hard to fake across a whole session |
| Repetition | How often the same address, device or account returns, and how many browsers share one device | Costly, because it means paying for more real devices |
| Solving services and farms | Relayed connections and many near-identical sessions | Hard while the work is done somewhere else |
Two of these are worth a closer look. Residential proxies make the address weaker than it looks: in one attack we measured, 131,819 residential IP addresses sent 1.4 million attack requests, but all of them came from just 8 TLS fingerprints and 14 user agents. And hardware is hard to disguise: SIMD instruction timing is one example, because a modified browser can report any number of processor cores but cannot change how long the processor takes to run the same instruction, as we explain in faking browsers is easy, but not at scale. Behaviour can also separate people from AI agents, as the scroll study above found.
No one of these is reliable on its own, and a well-built bot can make any single signal look right. The strength is in checking that they agree. A browser that claims one operating system but connects like another, or claims a phone but times like a server, is hard to fake consistently, because the network stack and the hardware are not something a modified browser can change. Checks that read only what JavaScript reports lose to browsers patched to report whatever the attacker likes.
Where to run the checks
Run checks at your CDN edge if you can, in front of every page and API endpoint, so a request is refused before it reaches your servers and costs you compute. Checks inside a form widget only see the visitors who reach that form.
Start in a preview mode that records what would be blocked without blocking it. A week or two of real traffic shows which rules catch customers, and it is much easier to fix those before they cost you a sale. Challenge visitors you are unsure about rather than blocking them, and keep a readable reason for every block, because the first time a real customer is refused, someone will need to explain why.
Bot blocking checklist
- List the bots you want, and allow them by verified identity, not by name.
- Include search engines, the AI crawlers and assistants you want citing you, uptime monitors, payment callbacks and partner integrations.
- Record how each one is verified: reverse DNS for Googlebot and Bingbot, published IP ranges for the AI crawlers.
- Use robots.txt to set your policy for search and AI crawlers.
- Add a
User-agentandDisallowblock for each AI crawler you do not want, such as GPTBot, ClaudeBot and CCBot, and the Google-Extended token for Gemini training. - Leave search crawlers alone unless you mean to drop out of search.
- Add a
- Block requests that use a known crawler's name from outside its published addresses.
- Refresh the vendors' IP range files regularly, because they change.
- Log what this rule blocks for a week before enforcing it, to catch any proxy or CDN in front of the real crawler.
- Rate-limit per endpoint, with tighter limits on login, sign-up, password reset and checkout.
- Count per account, session and device as well as per IP address, so a bot rotating proxy addresses still hits a limit.
- Rate-limit failed logins across the whole endpoint, not only per account.
- Put a CAPTCHA on the forms that matter, choosing one that checks who solved the challenge as well as the answer.
- Verify every token on your server, and make sure each one can be used once and expires quickly.
- Pass the visitor's IP address with the token when you verify it, so a token solved somewhere else can be refused.
- For pages and APIs bots target directly, add detection at the edge that compares network, device and behaviour evidence.
- Cover the API routes your apps call as well as your web pages.
- Decide per route whether a doubtful request is challenged or blocked.
- Run new rules in preview first, and record a reason for every block.
- Review what a rule would have caught before it blocks anything, and look for real customers among it.
- Keep the reason with each blocked request, so support can answer a customer who was refused.
How Prosopo blocks bots
Prosopo Protect runs at your edge on Cloudflare Workers or AWS Lambda@Edge, in front of every page and API you choose. It checks the network, device and behaviour evidence described above on each request, allows verified good bots, and lets you set rules for AI agents. It starts with 14 days in preview mode, so you see what it would block on your own traffic before it blocks anything, and every block carries a reason your team can read. Pricing is published on the pricing page, with traffic not metered.
For forms, Procaptcha checks the same network, device and behaviour evidence as well as the answer, and its IP validation rules can reject a token used from a different country, city or network from the one that solved it. It is free for 10,000 requests a month. For particular attacks, see scraping, credential stuffing and spam bot protection.
Bots getting through your current rules?
A Bot Exposure Assessment is a 30-minute call with an engineer. We look at your traffic, show where your current setup leaves gaps, and agree how a trial would be judged. Nothing to install first.
Questions
Something else? Ask an engineer.
How do I block bots on my website?
Start by deciding which bots you want: search engines and some AI crawlers bring visitors, and blocking them costs you traffic. Use robots.txt to tell well-behaved crawlers what to avoid, verify any crawler you allow against the operator's published IP list, add rate limits and edge rules for obvious abuse, and put a check in front of the pages and API endpoints that matter. Bots that ignore robots.txt and fake a browser need detection that looks at the network connection, the device and the visitor's behaviour together.
Does robots.txt block bots?
No. robots.txt is a request, not a block. Search engines and the main AI crawlers such as GPTBot and ClaudeBot follow it, but a scraper or attack tool simply ignores it. To stop a bot that ignores robots.txt you have to refuse its requests, at your server, your WAF or your CDN edge.
How do I block GPTBot and other AI crawlers?
Add a Disallow rule for each crawler's user agent in robots.txt, for example GPTBot, ClaudeBot, PerplexityBot, CCBot and the Google-Extended token. OpenAI, Anthropic and Perplexity follow these rules. Because anyone can copy those names, also check that requests using them come from the IP ranges each company publishes, and block requests that claim a crawler's name from anywhere else.
Can bots get past a CAPTCHA?
Paid solving services can get past a CAPTCHA that only checks whether the challenge was answered, by passing it to people or software. A CAPTCHA that also checks how and where the challenge was solved can detect them, because solving services leave traces: the answer is often used from a different connection or proxy than the one that solved it, the timing differs from a person filling in the form, and the same worker devices turn up across many unrelated sites.
How do I block bots without blocking real customers?
Run new rules in a mode that logs what they would block before you enforce them, look at what they catch, and challenge doubtful visitors rather than blocking them outright. Allow the good bots you rely on by verified identity, not by user agent, and record a reason for every block so you can explain it when a real customer complains.
Related reading
CAPTCHA · Procaptcha vs Friendly Captcha - Why Real Bot Protection Matters in 2026 Procaptcha vs Friendly Captcha in 2026 — catch rate, GDPR posture and pricing compared. Friendly is proof-of-work only; Procaptcha catches real bots.
Technical · How to Add CAPTCHA to Fastly CDN Learn how to integrate Procaptcha with Fastly CDN to protect your website from bot attacks while maintaining performance and user privacy.
CAPTCHA · Cloudflare Turnstile Alternatives 2026 — 8 Options Ranked Turnstile returns a pass/fail token and nothing to escalate to. How Prosopo, hCaptcha, ALTCHA and 5 others compare on catch rate, GDPR and price.
CAPTCHA · How to Stop PHP Form Spam (Without a Plugin) If your PHP mail script is being abused by bots, stop the bot before mail() runs — server-side CAPTCHA verification in a few lines of PHP, via Procaptcha.
Top Arkose Labs Alternatives 2026: Enterprise Bot Defense Without the Game Challenge Best Arkose Labs alternatives for 2026 — compare DataDome, HUMAN, Kasada and Prosopo for enterprise bot defense without visible game challenges.
Top DataDome Alternatives 2026: Enterprise Bot Defense Compared Best DataDome alternatives for 2026 — compare HUMAN, Kasada, Arkose Labs, Cloudflare and Prosopo on price, coverage and EU data residency.