Cloudflare Captcha Test: How to Safely Test Cloudflare Turnstile
Cloudflare’s official Turnstile test keys, how to render a test widget, and a live tester for any solver.
Cloudflare captcha test: the fast version
To run a cloudflare captcha test safely, use Cloudflare's official Turnstile test sitekeys instead of a real production widget. The dummy key 1x00000000000000000000AA always passes, 2x00000000000000000000AB always blocks, and 3x00000000000000000000FF forces an interactive challenge. Pair them with the test secret 1x0000000000000000000000000000000AA for server-side verification, then point your solver at a live widget to confirm end to end.
That's the short answer. The rest of this post walks through each test key, how to render a cloudflare turnstile test widget on localhost, the three widget modes you'll meet in the wild, the server-side siteverify step, and a live tester where you can throw any solver at real managed, non-interactive, and invisible widgets and watch Cloudflare's own backend confirm the token.
Why you want test keys, not a production site
Turnstile is Cloudflare's CAPTCHA replacement. If you want the background on what it is and the signals it watches, we wrote that up in what Cloudflare Turnstile is and how it works. The thing to know for testing: a real widget on a real domain ties into Cloudflare's risk scoring, rate limits, and your account's analytics. Hammering it with automated requests during development pollutes your own data and can trip protections you didn't mean to test.
So Cloudflare publishes dummy keys. They're deterministic. They don't score anything. They let you build and test the full flow without touching production risk logic. This is the correct way to wire up CI, local dev, and solver benchmarks.
Cloudflare Turnstile test keys
These are the real, documented cloudflare turnstile test keys. Drop them into your front end and back end exactly as you would production keys. They behave identically to a live widget from the browser's point of view, they just skip the actual challenge scoring.
Test sitekeys (client side)
| Sitekey | Behavior | Use it to test |
|---|---|---|
1x00000000000000000000AA | Always passes, visible widget | The happy path: token issued, form submits |
2x00000000000000000000AB | Always blocks | Your failure UX when a user can't pass |
1x00000000000000000000AA (invisible) | Always passes, invisible | Headless/managed flows with no visible box |
2x00000000000000000000AB (invisible) | Always blocks, invisible | Invisible-mode rejection handling |
3x00000000000000000000FF | Forces an interactive challenge | The checkbox/interaction path |
The 3x...FF key is the one people forget. Most dev environments only ever see the pass case, so the interactive challenge path never gets exercised until a real user hits it in production. Test it on purpose.
Test secret keys (server side)
| Secret key | siteverify result |
|---|---|
1x0000000000000000000000000000000AA | Always passes |
2x0000000000000000000000000000000AA | Always fails |
3x0000000000000000000000000000000AA | Yields a "token already spent" error |
Mix and match. A pass sitekey with a fail secret lets you simulate a token that looks fine client side but gets rejected by your server, which is exactly the edge case that catches sloppy validation code.
Render a cloudflare demo widget locally
Here's a minimal cloudflare demo page you can open on localhost. No build step, no account needed because the sitekey is a public dummy.
<!DOCTYPE html>
<html>
<head>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
</head>
<body>
<form action="/submit" method="POST">
<div class="cf-turnstile" data-sitekey="1x00000000000000000000AA"></div>
<button type="submit">Submit</button>
</form>
</body>
</html>
Load it, and the always-passes key drops a cf-turnstile-response token into a hidden input inside the form. Swap the data-sitekey value to 2x00000000000000000000AB to see the block state, or 3x00000000000000000000FF to get the interactive challenge. Everything you'd test against production, minus the scoring.
The three widget modes
Turnstile runs in one of three modes, and your test needs to cover whichever one your site uses. They differ in how much the user sees and does.
- Managed: Cloudflare decides. Most visitors get an invisible pass; suspicious ones get a checkbox or a short interactive step. This is the default and the one you'll hit most often when solving someone else's widget.
- Non-interactive: A visible widget that never asks the user to do anything. It shows a spinner, runs its checks, and issues a token. No click required.
- Invisible: No widget renders at all. The challenge runs in the background and the token appears when it's done. Common on login and signup forms where you don't want a visible box.
A token from any mode goes to the same place: your server, for verification. The mode changes the user experience and the browser-side timing, not the validation contract.
The server-side siteverify step
A token in the browser means nothing until your server checks it. This is the part people skip, and it's the part that actually enforces anything. Send the token to Cloudflare's siteverify endpoint with your secret key:
curl -X POST https://challenges.cloudflare.com/turnstile/v0/siteverify \
-d "secret=1x0000000000000000000000000000000AA" \
-d "response=<token-from-the-widget>"
With the always-passes test secret you get {"success": true, ...} back. Swap to the always-fails secret 2x0000000000000000000000000000000AA and you get success: false no matter what token you send. That's your proof that the server half rejects correctly. Build both paths before you ship.
One real-world note: siteverify tokens are single-use and expire after about five minutes. If your tests reuse a token, you'll see a timeout-or-duplicate error, and the 3x...AA secret simulates exactly that. Worth wiring into a test case so a stale token in production doesn't surprise you.
Test any solver against real widgets: the live tester
Dummy keys prove your integration works. They don't prove a solver works, because a dummy key never issues a real challenge to solve. For that you need a live widget and real Cloudflare verification on the other end. That's what the Peak Cloudflare Turnstile tester is for.
Open it and you get three real widgets on the page: managed, non-interactive, and invisible. Each one is a genuine Turnstile instance with a real sitekey, not a dummy. You do one of two things:
- Solve the widget yourself in the browser, or
- Point your own solver (or Peak's API) at the page's sitekey and get back a token.
Then you submit the token and the demo's server calls Cloudflare's siteverify with the matching secret. Cloudflare's own backend decides whether the token is valid, and the page shows you the verdict. No trusting the tool's word for it, the verification comes straight from Cloudflare. That's the whole point: the live cloudflare turnstile test closes the loop that dummy keys can't.
This beats the usual "demo" that just shows a widget rendering. Rendering is easy. Producing a token that Cloudflare actually accepts is the hard part, and that's the only thing worth measuring. Benchmark your solver against all three modes on the Turnstile tester and you know whether it holds up before you wire it into anything.
Solving a live widget with Peak
If you need tokens for a widget you're authorized to automate, Peak's API returns one in about a second. You give it the page URL and the sitekey; it gives you a token you can submit to siteverify. Here's the whole call.
# curl
curl -X POST https://api.peak.fo/solve \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"task_type": "turnstiletaskproxyless",
"url": "https://peak.fo/demo/cloudflare-turnstile",
"sitekey": "0x4AAAAAAA..."
}'
# Python
import requests
r = requests.post(
"https://api.peak.fo/solve",
headers={"X-API-Key": "YOUR_KEY"},
json={
"task_type": "turnstiletaskproxyless",
"url": "https://peak.fo/demo/cloudflare-turnstile",
"sitekey": "0x4AAAAAAA...",
},
)
token = r.json()["data"]["token"]
print(token) # 1.xxxx...
The response looks like {"success": true, "data": {"token": "1.xxxx"}, "cost": 0.0009}. You pay only for solves that succeed. Typical turnaround is around a second, and pricing runs from $0.90 per 1,000 solves down to about $0.35 at volume. The full breakdown is on the Peak pricing page.
To find the sitekey for any widget you're testing, you pull it out of the page's HTML or the widget's network call. We covered every method in how to find a Cloudflare Turnstile sitekey, so I won't repeat it here.
A sane testing checklist
Put it together and a thorough Turnstile test looks like this:
- Render the widget locally with
1x00000000000000000000AAand confirm the happy path submits. - Swap to
2x00000000000000000000ABand confirm your block UX shows up. - Swap to
3x00000000000000000000FFand confirm the interactive challenge path works. - On the server, test
siteverifywith both the pass and the fail test secrets. - Test token reuse with
3x0000000000000000000000000000000AAso a duplicate token is handled, not crashed on. - For solver work, run it against real managed, non-interactive, and invisible widgets on the live Turnstile tester and let Cloudflare confirm each token.
Keep it legitimate. Automate widgets you own or are authorized to test, respect the target site's terms and robots.txt, and don't use any of this for credential stuffing or abuse. Test keys and the live tester exist so you can build and verify honestly.
Go run the test
Cloudflare's dummy keys cover your integration; the live tester covers your solver. Head to the Cloudflare Turnstile tester, pick a widget mode, submit a token, and watch Cloudflare verify it in real time. If you want tokens on demand while you're there, grab a key and point Peak's /solve at the same page.