Explainers

How Cloudflare Turnstile Works

Cloudflare Turnstile is a CAPTCHA replacement that verifies users without image challenges. It uses browser-level signals like Private Access Tokens, JavaScript execution challenges, and behavioral analysis to determine if a visitor is human.

Launched in 2022, Turnstile is designed to be privacy-preserving — it does not track users across sites or use cookies for fingerprinting.


How Turnstile verification works

  1. Widget loads — The site includes challenges.cloudflare.com/turnstile/v0/api.js with a sitekey
  2. Browser challenges run — Turnstile executes lightweight JavaScript challenges in the background
  3. Signals collected — Browser environment, execution timing, and hardware signals are analyzed
  4. Token generated — If the browser passes, Turnstile generates a cf-turnstile-response token
  5. Backend verification — The site sends the token to Cloudflare's siteverify endpoint
  6. Response returned — Cloudflare confirms the token is valid and returns a success/failure response
User visits page
      ↓
Turnstile JS loads
      ↓
Background challenges run (< 1 second)
      ↓
Token generated → sent to site backend
      ↓
Backend calls siteverify → Cloudflare confirms
      ↓
User gains access

Turnstile widget modes

Mode Behavior User sees
Managed Decides automatically whether to show widget Sometimes a checkbox, usually nothing
Non-interactive Always runs silently Nothing — completely invisible
Invisible No widget rendered at all Nothing

Most sites use managed mode, where Turnstile shows a brief loading spinner and then auto-completes without user interaction.


What Turnstile checks

Unlike reCAPTCHA, Turnstile does not analyze mouse movement or page interactions. Instead, it focuses on:

Signal What it measures
JavaScript execution Can the browser execute specific JS challenges?
Timing analysis How fast does the browser complete challenges?
Browser APIs Are expected APIs present and functional?
Private Access Tokens Does the device support Apple/Google PATs?
WebAssembly Can the browser execute WASM modules?
Canvas/WebGL Browser rendering capabilities
Environment consistency Do claimed and actual browser features match?

Turnstile vs reCAPTCHA

Feature Turnstile reCAPTCHA v2 reCAPTCHA v3
User interaction Rarely Checkbox + images None
Image challenges Never Yes No
Score-based No (pass/fail) No (pass/fail) Yes (0.0–1.0)
Privacy No cross-site tracking Uses Google cookies Uses Google cookies
Requires Google account No Benefits from it Benefits from it
Free tier Yes Yes Yes
Self-hosted option No (Cloudflare only) No (Google only) No (Google only)

Turnstile vs Cloudflare Challenge

These are different products:

Feature Turnstile Cloudflare Challenge
Integration Site adds widget to their page Cloudflare proxy shows interstitial
Requirements Any website Site must use Cloudflare as proxy
Page access User is already on the page User cannot reach the page until verified
Cookie set No cf_clearance Sets cf_clearance cookie
Proxy needed for solving No Yes

Finding Turnstile on a page

Look for these indicators:

<!-- Script tag -->
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js"></script>

<!-- Widget container -->
<div class="cf-turnstile" data-sitekey="0x4AAAAAAAD..."></div>

<!-- Or explicit render -->
<script>
  turnstile.render('#container', {
    sitekey: '0x4AAAAAAAD...',
    callback: function(token) { /* handle token */ }
  });
</script>

The sitekey always starts with 0x4 followed by alphanumeric characters.


Solving Turnstile with CaptchaAI

import requests
import time

response = requests.get("https://ocr.captchaai.com/in.php", params={
    "key": "YOUR_API_KEY",
    "method": "turnstile",
    "sitekey": "0x4AAAAAAAD...",
    "pageurl": "https://example.com/login",
    "json": 1
})

task_id = response.json()["request"]

for _ in range(30):
    time.sleep(5)
    result = requests.get("https://ocr.captchaai.com/res.php", params={
        "key": "YOUR_API_KEY", "action": "get", "id": task_id, "json": 1
    }).json()
    if result.get("status") == 1:
        token = result["request"]
        print(f"Turnstile token: {token[:50]}...")
        break

FAQ

Does Turnstile work without JavaScript?

No. Turnstile requires JavaScript to execute its browser challenges. Noscript browsers will fail.

Can Turnstile be used on non-Cloudflare sites?

Yes. Unlike Cloudflare Challenge pages, Turnstile is a standalone widget that any website can embed — the site does not need to use Cloudflare as its DNS/CDN provider.

Does Turnstile use cookies?

Turnstile may set a cf_clearance-like cookie in some configurations, but it does not use third-party tracking cookies like Google's reCAPTCHA.

How fast is Turnstile verification?

For real users, typically under 1 second. Most users never see any visible widget. Solving via CaptchaAI takes 10–20 seconds.


Discussions (0)

No comments yet.

Related Posts

Reference CAPTCHA Token Injection Methods Reference
Complete reference for injecting solved CAPTCHA tokens into web pages.

Complete reference for injecting solved CAPTCHA tokens into web pages. Covers re CAPTCHA, Turnstile, and Cloud...

Automation Python reCAPTCHA v2
Apr 08, 2026
Tutorials Pytest Fixtures for CaptchaAI API Testing
Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI.

Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI. Covers mocking, live integra...

Automation Python reCAPTCHA v2
Apr 08, 2026
Reference Browser Session Persistence for CAPTCHA Workflows
Manage browser sessions, cookies, and storage across CAPTCHA-solving runs to reduce repeat challenges and maintain authenticated state.

Manage browser sessions, cookies, and storage across CAPTCHA-solving runs to reduce repeat challenges and main...

Automation Python reCAPTCHA v2
Feb 24, 2026
Integrations Browser Profile Isolation + CaptchaAI Integration
Browser profile isolation tools create distinct browser environments with unique fingerprints per session.

Browser profile isolation tools create distinct browser environments with unique fingerprints per session. Com...

Automation Python reCAPTCHA v2
Feb 21, 2026
Comparisons WebDriver vs Chrome DevTools Protocol for CAPTCHA Automation
Compare Web Driver and Chrome Dev Tools Protocol (CDP) for CAPTCHA automation — detection, performance, capabilities, and when to use each with Captcha AI.

Compare Web Driver and Chrome Dev Tools Protocol (CDP) for CAPTCHA automation — detection, performance, capabi...

Automation Python reCAPTCHA v2
Mar 27, 2026
Tutorials CAPTCHA Handling in Flask Applications with CaptchaAI
Integrate Captcha AI into Flask applications for automated CAPTCHA solving.

Integrate Captcha AI into Flask applications for automated CAPTCHA solving. Includes service class, API endpoi...

Automation Cloudflare Turnstile
Mar 17, 2026
Use Cases CAPTCHA Solving in Ticket Purchase Automation
How to handle CAPTCHAs on ticketing platforms Ticketmaster, AXS, and event sites using Captcha AI for automated purchasing workflows.

How to handle CAPTCHAs on ticketing platforms Ticketmaster, AXS, and event sites using Captcha AI for automate...

Automation Python reCAPTCHA v2
Feb 25, 2026
Tutorials Caching CAPTCHA Tokens for Reuse
Cache and reuse CAPTCHA tokens with Captcha AI to reduce API calls and costs.

Cache and reuse CAPTCHA tokens with Captcha AI to reduce API calls and costs. Covers token lifetimes, cache st...

Automation Python reCAPTCHA v2
Feb 15, 2026
Use Cases Event Ticket Monitoring with CAPTCHA Handling
Build an event ticket availability monitor that handles CAPTCHAs using Captcha AI.

Build an event ticket availability monitor that handles CAPTCHAs using Captcha AI. Python workflow for checkin...

Automation Python reCAPTCHA v2
Jan 17, 2026
Explainers How BLS CAPTCHA Works: Grid Logic and Image Selection
Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how Captcha AI processes BLS challenges.

Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how C...

Automation BLS CAPTCHA
Apr 09, 2026
Explainers Browser Fingerprinting and CAPTCHA: How Detection Works
How browser fingerprinting affects CAPTCHA challenges, what signals trigger CAPTCHAs, and how to reduce detection with Captcha AI.

How browser fingerprinting affects CAPTCHA challenges, what signals trigger CAPTCHAs, and how to reduce detect...

reCAPTCHA v2 Cloudflare Turnstile reCAPTCHA v3
Mar 23, 2026
Explainers GeeTest v3 Challenge-Response Workflow: Technical Deep Dive
A technical deep dive into Gee Test v 3's challenge-response workflow — the registration API, challenge token exchange, slider verification, and how Captcha AI...

A technical deep dive into Gee Test v 3's challenge-response workflow — the registration API, challenge token...

Automation Testing GeeTest v3
Mar 02, 2026