How does bot detection work?
Short answer
Bot detection collects signals from each request and visit: the IP address and its network, the TLS and HTTP fingerprint of the client, browser attributes read by JavaScript, and how the visitor moves, types and browses. It checks whether these agree with each other and with real browsers, turns them into a score, then allows, challenges, slows or blocks the request.
Every request that reaches a website carries evidence about the software that sent it. Some of it sits in the network connection, some in the HTTP headers, and much more appears once JavaScript runs in the page. Bot detection gathers that evidence, compares it with what real browsers and real people produce, and decides what to do with the request.
What signals does bot detection check?
Most systems work in layers, starting with the cheapest data and adding richer data when the page allows it.
- The IP address, its ASN (the network that owns the address, such as a cloud host or a home broadband provider), its past behaviour and the request rate. This data exists on every request, but residential proxies make a bot's IP look like an ordinary household.
- The order and values of HTTP headers, HTTP/2 settings and the TLS handshake. A TLS fingerprint such as JA4 shows which client library opened the connection, whatever the User-Agent header claims.
- Attributes a JavaScript collector reads in the page: screen size, fonts, graphics renderer, time zone, language and many more. Together they form a browser fingerprint, and the same script looks for traces left by automation frameworks.
- Pointer movement, typing rhythm, scrolling, the time spent on each step and the order of pages. Behavioral bot detection covers this layer.
- Whether this IP, device or account has been seen before, what it did then, and which other accounts share its device or network.
Why do the signals need to agree?
Any single value can be faked. Changing the User-Agent string takes one line of code, and IP addresses can be rented by the thousand. Making every layer tell the same story is much harder.
Take a request that claims to be Chrome on Windows. It arrives with the TLS handshake of a Python HTTP library, its client hints report Linux, its time zone does not match the country of its IP, and the IP belongs to a cloud provider. Each fact alone has an innocent explanation: a corporate proxy, a traveller, a developer testing. All of them together describe a script.
Bot builders patch individual leaks, so a check for one specific flag tends to stop working after a few browser or framework releases. Contradictions between layers last longer, because removing them means controlling everything from the TCP connection up to the graphics stack.
How do signals become a decision?
Hand-written rules are the simplest form: "challenge requests to /login from hosting networks that have not run the JavaScript check". People can read and audit them, and attackers can learn them by trial and error. Scoring systems give each signal a weight, or use a model trained on labelled traffic, and add up the evidence. Most products mix both, with reputation from earlier visits feeding the score.
The score then maps to an action: allow, log only, slow down with a rate limit, challenge, block, or let the request through and flag the account for review. Thresholds should differ by endpoint. A login form, signup page or checkout justifies a stricter threshold than a blog article, because a bot there costs more. For uncertain scores, an invisible JavaScript challenge asks the browser to prove it is a real browser without asking the person to solve a puzzle. Visible friction has a price in lost customers, a trade-off covered in why friction-based defences stop more users than attackers.
How are good bots handled?
Search engine crawlers, uptime monitors, payment webhooks and partner integrations are automated but wanted. Their names in the User-Agent can be copied by anyone, so detection systems verify them. The usual method is a reverse DNS lookup on the IP, a check that the hostname belongs to the operator, then a forward lookup to confirm it points back to the same IP. Google documents this for Googlebot, and several operators also publish their IP ranges. Some agents sign their requests with HTTP Message Signatures (RFC 9421), which lets a site check the sender with a public key. Verified bots usually skip scoring and go straight to an allow rule. The details are in how to verify Googlebot and other good bots.
Where does bot detection run?
At the CDN or edge, detection sees every request before it reaches your servers, which suits high-volume attacks and scraping. At a reverse proxy or inside the application, it knows the business context: whether a login failed, which account was targeted, whether a card was declined.
In the browser, a JavaScript collector gathers the richest data, but only after the page has loaded and the script has run. The first request of a visit arrives before any of that exists, so the first decision rests on network and protocol signals alone. Mobile apps replace the browser script with an SDK and platform attestation, such as Apple App Attest or Google Play Integrity.
Why does bot detection get it wrong?
Errors go both ways. False positives are real people whose setup looks unusual: privacy browsers that randomise fingerprint values, VPN users on data centre IPs, in-app browsers inside social media apps, and offices that send hundreds of staff through one IP. False negatives are bots that run a real browser on a home IP, and people paid to solve challenges by hand.
No setting removes both kinds of error. Run new rules in a log-only mode first, compare what they would have blocked with what those visitors did next, and track both error types per segment. False positives in bot detection explains how to measure them.
Common questions
What is a bot check?
A bot check is a test a site runs before letting a request through. It can be invisible, such as JavaScript that inspects the browser and solves a small task in the background, or visible, such as a CAPTCHA. Most visitors on a well-tuned site never see the visible kind.
Does bot detection use machine learning?
Most commercial systems use machine learning models to weigh signals, usually next to hand-written rules. Models need labelled examples of bot and human traffic, and those labels are the hard part, so rules still handle known patterns and verified good bots.
Does user agent bot detection still work?
Only for bots that announce themselves, such as crawlers or scripts that keep a default library User-Agent. Any bot that wants to hide copies a current browser string, so the header is useful for allowing declared bots and for spotting contradictions, and weak as proof of anything.