Explainers

Cloudflare Turnstile Widget Customization: Themes and Render Modes

Cloudflare Turnstile gives site owners control over how the verification widget looks and behaves. Sites choose between visible and invisible modes, light and dark themes, and explicit or implicit rendering. These choices change the user experience but not the solving process — CaptchaAI handles all Turnstile configurations with a 100% success rate.

Widget Modes

Turnstile offers three operational modes:

Managed Mode

The default mode. Cloudflare decides whether to show a visible challenge:

<div class="cf-turnstile" data-sitekey="0x4AAAA..." data-theme="light"></div>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
  • Shows a small widget (similar in size to reCAPTCHA checkbox)
  • May auto-complete without user interaction if risk is low
  • May show a brief challenge animation if risk is moderate
  • User never sees image grids or complex puzzles

Non-Interactive Mode

Runs entirely in the background with no user interaction:

<div class="cf-turnstile" data-sitekey="0x4AAAA..." data-appearance="interaction-only"></div>
  • No visible widget unless interaction is needed
  • Cloudflare's challenge runs silently via JavaScript
  • If the silent check passes, the token is generated automatically
  • Falls back to an interactive widget only if the silent check fails

Invisible Mode

Completely hidden. Triggered programmatically:

turnstile.execute('0x4AAAA...', {
  action: 'login',
  cData: 'custom-data'
});
  • No visible element on the page
  • Site calls turnstile.execute() at the appropriate moment
  • Token is generated and passed via callback
  • User never sees any widget

Visual Themes

Theme Appearance HTML attribute
Light White background, dark text data-theme="light"
Dark Dark background, light text data-theme="dark"
Auto Matches user's system preference data-theme="auto"

Themes affect only the visual appearance. CaptchaAI solving is not impacted by theme selection.

Widget Sizes

Size Dimensions HTML attribute
Normal 300×65 px data-size="normal"
Flexible Adapts to container width data-size="flexible"
Compact 150×140 px data-size="compact"

Render Modes

Sites choose how the Turnstile script initializes:

Implicit Rendering

The script auto-renders widgets found in the DOM:

<div class="cf-turnstile" data-sitekey="0x4AAAA..."></div>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>

The script scans for elements with class cf-turnstile and renders widgets automatically.

Explicit Rendering

The script loads but doesn't render until called:

<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit" async defer></script>
<script>
  turnstile.render('#captcha-container', {
    sitekey: '0x4AAAA...',
    callback: function(token) {
      document.getElementById('cf-token').value = token;
    }
  });
</script>

Explicit rendering is common in SPAs where the widget container doesn't exist in the initial HTML.

Configuration Attributes

Full list of data-* attributes supported on the widget div:

Attribute Values Default Purpose
data-sitekey Site key string Required Identifies the Turnstile configuration
data-theme light, dark, auto auto Visual theme
data-size normal, flexible, compact normal Widget dimensions
data-language ISO code (e.g., en, ja) Auto-detected Widget text language
data-callback Function name Called with token on success
data-error-callback Function name Called on error
data-expired-callback Function name Called when token expires
data-action Action label Identifies the page action
data-cdata Custom data string Passed through to verification
data-appearance always, execute, interaction-only always When to show the widget
data-retry auto, never auto Whether to auto-retry on failure
data-retry-interval Milliseconds 8000 Delay between auto-retries
data-tabindex Number 0 Tab order for accessibility

How Each Mode Affects Solving

CaptchaAI solves all Turnstile modes identically. You submit the same parameters:

Parameter Value
key Your CaptchaAI API key
method turnstile
sitekey The Turnstile site key (0x4AAAA...)
pageurl The page URL

Extracting the Site Key

Regardless of render mode, the site key appears in one of these locations:

# Implicit: data-sitekey attribute
site_key = page.eval_on_selector(
    ".cf-turnstile", "el => el.dataset.sitekey"
)

# Explicit: in the turnstile.render() call
# Search page source for sitekey
import re
source = page.content()
match = re.search(r"sitekey['\"]?\s*[:=]\s*['\"]?(0x[A-Za-z0-9]+)", source)
site_key = match.group(1) if match else None

Token Handling by Mode

Mode Token delivery How to capture
Managed Hidden input cf-turnstile-response Read from form field
Non-Interactive Same hidden input Read from form field
Invisible Callback function Intercept callback or read injected field
Explicit Callback function parameter Intercept callback

When using CaptchaAI, you inject the token into the appropriate location:

# For managed/non-interactive: set the hidden input
page.evaluate(f"""
    document.querySelector('[name="cf-turnstile-response"]').value = '{token}';
""")

# For explicit with callback: trigger the callback
page.evaluate(f"window.turnstileCallback('{token}')")

Troubleshooting

Issue Cause Fix
Can't find site key Explicit rendering, key in JS bundle Search page source and scripts for 0x4 prefix
Widget not rendering SPA — container doesn't exist yet Wait for the container element before extracting
Token field name differs Site uses custom field name Inspect the form to find the correct field
Auto-retry conflicts data-retry="auto" refreshes widget Inject token before the widget auto-retries

FAQ

Does the Turnstile theme affect solving difficulty?

No. Theme is purely visual. CaptchaAI's solving process is independent of the widget's appearance.

Is invisible Turnstile harder to solve than managed?

No. CaptchaAI solves all modes with the same parameters and the same 100% success rate. The mode only affects how the widget appears to users.

How do I handle explicit rendering in automation?

Wait for the turnstile.render() call to execute (watch for the widget iframe to appear), extract the site key from the render call or the resulting widget element, then proceed normally.

Next Steps

Solve any Turnstile widget configuration — get your CaptchaAI API key for 100% Turnstile success rate.

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
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