# What is a CAPTCHA and how does it work?

> A CAPTCHA is a test that tries to tell a person from a program. The site loads a widget that shows a puzzle or runs hidden checks in the browser. When the visitor passes, the widget returns a short-lived token, and the site's server sends that token to the CAPTCHA vendor to confirm it before accepting the form.

Category: CAPTCHA and challenges. Level: Basic. Updated: 2026-11-24.
Canonical page: https://stopbots.io/learn/captcha/what-is-a-captcha/

CAPTCHA stands for Completely Automated Public Turing test to tell Computers and Humans Apart. Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford at Carnegie Mellon University coined the term in a 2003 paper. Their idea was to build a test from a problem computers could not yet solve, such as reading warped text, so that any program able to pass it would also mark progress in AI. That bet has played out. Machines now solve most classic puzzles, and modern CAPTCHA services put more weight on hidden checks of the browser than on the answer.

## How does a CAPTCHA work?

Hosted CAPTCHAs such as reCAPTCHA, hCaptcha and Cloudflare Turnstile all follow the same steps:

1. Your page loads the vendor's script with your public site key.
2. The widget runs checks in the browser and, if the risk looks high, shows a puzzle.
3. When the visitor passes, the vendor issues a token and the widget puts it in a hidden form field.
4. The browser submits the form with the token. Your server sends the token and your secret key to the vendor's verification endpoint.
5. The vendor answers with success or failure, plus details such as the hostname where the test ran and when it ran. Your server then accepts or rejects the request.

Here is step 4 for reCAPTCHA, using the endpoint from [Google's verification docs](https://developers.google.com/recaptcha/docs/verify):

```http
POST /recaptcha/api/siteverify HTTP/1.1
Host: www.google.com
Content-Type: application/x-www-form-urlencoded

secret=YOUR_SECRET_KEY&response=TOKEN_FROM_THE_FORM&remoteip=203.0.113.7
```

```json
{
  "success": true,
  "challenge_ts": "2026-11-24T10:15:02Z",
  "hostname": "shop.example.com"
}
```

Check step 4 first when you audit a form. If the server never calls the verification endpoint, the widget is decoration: a bot can post the form directly without loading the page. Tokens are short-lived and single use. Google's tokens are valid for two minutes, and a second verification of the same token fails with `timeout-or-duplicate`.

## What types of CAPTCHA are there?

- Distorted text. The visitor types letters from a warped image. This was the first common type. Machine learning reads it reliably, so few sites still depend on it.
- Image selection. "Select all squares with traffic lights." reCAPTCHA v2 and hCaptcha show grids like this when they want more evidence.
- Audio. Spoken digits or words for visitors who cannot see the image. Speech recognition models handle many of these.
- Checkbox. The "I'm not a robot" box. The click matters less than what the widget measures around it: the browser, its cookies and how the visitor reached the box.
- Score only. reCAPTCHA v3 shows nothing and returns a score from 0.0 to 1.0, and your code decides what to do. See [reCAPTCHA v2 vs v3](https://stopbots.io/learn/captcha/recaptcha-v2-vs-v3.md).
- Managed and invisible challenges. Turnstile runs browser checks and shows at most a checkbox.
- Proof of work. The browser spends some CPU time on a hash puzzle and the visitor sees a short wait. See [proof-of-work challenges](https://stopbots.io/learn/captcha/proof-of-work-challenges.md).
- Sliders and games. Drag a piece into a gap, or turn an object upright.

## Where do websites use CAPTCHA?

They appear where an automated request costs the site something. Sign-up forms attract fake accounts. Login forms attract [credential stuffing](https://stopbots.io/learn/account-attacks/what-is-credential-stuffing.md), where bots try leaked username and password pairs. Contact and comment forms attract spam. Checkout and gift card balance pages attract card testing. Ticket and limited-release sales attract scalpers. Password reset and SMS code requests attract bots that run up messaging bills.

Put the check on the action that costs money or creates an account, not on every page view. Each visible challenge loses some real visitors, and challenges on every page teach people to click through without reading.

## What does passing a CAPTCHA prove?

A valid token shows that someone or something passed the test for your site key within the last few minutes. It does not show that the visitor is a person, that it is the same visitor as last time, or that the request is honest. Bots get valid tokens from [CAPTCHA solving services](https://stopbots.io/learn/captcha/how-captcha-solvers-work.md), which pass the test with human workers or machine learning models and sell the token.

For this reason the vendors now lean on the hidden checks: whether the browser is consistent with what it claims to be, the reputation of the IP address, cookies from earlier visits and how the page was used. That is the same work as [bot detection](https://stopbots.io/learn/detection/how-bot-detection-works.md), done once at the moment of the form. Sites with real attack pressure run those checks on every sensitive request and keep the puzzle for the few visitors whose evidence is unclear.

## Common questions

### Why is CAPTCHA used?

To make each automated attempt slower or more expensive than it is worth. That is enough to stop low-effort spam scripts, but a pass tells you nothing about who is behind the request.

### What is the difference between CAPTCHA and reCAPTCHA?

CAPTCHA is the general name for any test of this kind. reCAPTCHA is one product: it started at Carnegie Mellon, Google acquired it in 2009, and it now runs as v2 (checkbox and image challenges) and v3 (a score with no challenge).

### Are CAPTCHAs used to train AI?

The original reCAPTCHA showed words from scanned books that OCR software could not read, so human answers helped digitise text, as its creators described in Science in 2008. Image challenges collect human labels for photos, so read each vendor's terms to see what it does with the answers.

## Related

- [Do CAPTCHAs stop bots?](https://stopbots.io/learn/captcha/do-captchas-stop-bots.md)
- [How CAPTCHA solving services work](https://stopbots.io/learn/captcha/how-captcha-solvers-work.md)
- [CAPTCHA alternatives: how to stop bots without a puzzle](https://stopbots.io/learn/captcha/captcha-alternatives.md)
- [How does bot detection work?](https://stopbots.io/learn/detection/how-bot-detection-works.md)
