# What is a bot?

> A bot is a program that uses websites, apps or APIs automatically, without a person driving each step. It sends the same kind of requests a browser sends. Some bots are useful, like search engine crawlers and uptime monitors. Others log in with stolen passwords, copy content, buy limited stock or fill forms with spam.

Category: Bot basics. Level: Basic. Updated: 2026-11-24.
Canonical page: https://stopbots.io/learn/bots/what-is-a-bot/

Most site owners underestimate how many bots they get because their analytics tool hides them. A JavaScript analytics tag only counts visitors that run JavaScript, and many bots only download the HTML. Server and CDN logs show every request, and on many sites a large share of those come from software. Public estimates of that share are covered in [how much internet traffic is bots](https://stopbots.io/learn/bots/how-much-internet-traffic-is-bots.md).

## What kinds of bots visit websites?

Bots differ by who runs them and what they want from your site:

- Search engine crawlers, such as Googlebot and Bingbot, fetch pages so they can appear in search results.
- AI crawlers collect pages to train models or to answer questions in AI search. AI agents act for one user, for example to compare prices or fill a form. See [what AI crawlers are](https://stopbots.io/learn/scraping/what-are-ai-crawlers.md).
- Monitoring and preview bots check uptime, read RSS feeds and build the link previews you see in chat apps.
- Scrapers copy prices, listings, articles or contact details for use elsewhere.
- Account attack bots try stolen passwords on login forms or create fake accounts in bulk.
- Purchase bots buy limited stock such as tickets and sneakers, or test stolen card numbers with small payments.
- Spam bots post junk to contact forms, comments and reviews.

## How does a website know a request came from a bot?

A server never sees a person. It sees an IP address, a TLS handshake, HTTP headers and the order of requests. If the page runs JavaScript, it can also read browser properties and input events such as mouse movement and typing.

Honest bots name themselves in the `User-Agent` header and link to a page that explains them. A Googlebot request in an nginx or Apache access log looks like this:

```txt
66.249.66.1 - - [24/Nov/2026:10:15:32 +0000] "GET /pricing HTTP/1.1" 200 5123 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
```

Bots that want to avoid blocks send the user agent of a normal Chrome or Safari browser instead. The user agent is plain text the client chooses, so it proves nothing on its own. Detection compares what the client claims with what it shows. A request that says Chrome but completes the TLS handshake like a Python library, or a browser that clicks a button 40 milliseconds after the page loads, is a bot whatever its header says. [How bot detection works](https://stopbots.io/learn/detection/how-bot-detection-works.md) covers these signals in order.

To see which self-declared bots reach your site, count user agents in a standard combined-format access log:

```bash
awk -F'"' '{print $6}' access.log | sort | uniq -c | sort -rn | head -20
```

Names containing `bot`, `crawler` or `spider` are the honest ones. The rest of the list is browsers, real or claimed.

## What is the difference between a bot and a botnet?

A bot is one program. It can run on a laptop, a rented cloud server or thousands of machines at once. A botnet is a set of devices that malware has taken over, such as home routers, cameras and PCs, which one operator controls remotely. Botnets give bad bots many home IP addresses to send traffic from. [What a botnet is](https://stopbots.io/learn/bots/what-is-a-botnet.md) explains how they are built and rented out.

## Are bots legal?

Writing and running a bot is legal in most countries. Search engines, price monitors and test suites are all bots. The law looks at what the bot does and how.

Logging in to accounts with stolen credentials is unauthorised access under computer misuse laws in most places. In the United States, the [BOTS Act of 2016](https://www.congress.gov/bill/114th-congress/senate-bill/3183) targets software that gets around the purchase limits and security measures of ticket sellers. Scraping sits in a grey area that depends on the data, the site's terms and the country, which is covered in [is web scraping legal](https://stopbots.io/learn/scraping/is-web-scraping-legal.md). These rules vary by jurisdiction, and nothing here is legal advice.

Whether a bot is welcome on your site is a separate question from whether it is legal. That decision, and how to check a bot's identity before you trust it, is in [good bots vs bad bots](https://stopbots.io/learn/bots/good-bots-vs-bad-bots.md).

## Common questions

### Is a chatbot the same as a web bot?

No. A chatbot talks with people in a chat window. A web bot visits sites or calls APIs on its own. The two meet when an AI assistant browses pages for a user, which is why sites now see AI agents in their logs.

### Can a bot look exactly like a human visitor?

It can come close. A bot that drives a real browser through a home IP address passes most single checks, so detection has to combine many weak signals from the network, the device and behaviour over the whole visit.

### Are bots illegal?

Writing or running a bot is legal in most countries. What the bot does can be illegal, for example breaking into accounts or getting around ticket purchase limits. The answer depends on the jurisdiction, and this is not legal advice.

## Related

- [Good bots vs bad bots: how to tell them apart](https://stopbots.io/learn/bots/good-bots-vs-bad-bots.md)
- [What is bot traffic?](https://stopbots.io/learn/bots/what-is-bot-traffic.md)
- [How does bot detection work?](https://stopbots.io/learn/detection/how-bot-detection-works.md)
- [AI agents vs bots: how to treat agentic traffic](https://stopbots.io/learn/scraping/ai-agents-vs-bots.md)
