ProductsIntegrationsResourcesDocumentationPricing
Start Now

© 2026 CapSolver. All rights reserved.

CONTACT US

Slack: lola@capsolver.com

Products

  • reCAPTCHA v2
  • reCAPTCHA v3
  • Cloudflare Turnstile
  • Cloudflare Challenge
  • AWS WAF
  • Browser Extension
  • Many more CAPTCHA types

Integrations

  • Selenium
  • Playwright
  • Puppeteer
  • n8n
  • Partners
  • View All Integrations

Resources

  • Referral System
  • Documentation
  • API Reference
  • Blog
  • FAQs
  • Glossary
  • Status

Legal

  • Terms & Conditions
  • Privacy Policy
  • Refund Policy
  • Don't Sell My Info
//How to Solve Cloudflare in 2026: Solve Cloudflare Turnstile and Challenge By Using CapSolver
May07, 2024

How to Solve Cloudflare in 2026: Solve Cloudflare Turnstile and Challenge By Using CapSolver

Ethan Collins

Ethan Collins

Pattern Recognition Specialist

Cloudflare offers robust protection measures, including the Cloudflare Challenge and Turnstile CAPTCHA, to secure websites from malicious bots and automated scrapers. Understanding and overcoming these challenges can be crucial for those needing access beyond these protective barriers for legitimate purposes.

Understanding Cloudflare's Security Measures

Cloudflare employs various techniques to detect and mitigate unwanted traffic. Among these are the Cloudflare Challenge, which often involves JavaScript challenges or CAPTCHA tests, and Turnstile, a more user-friendly CAPTCHA that minimizes user interaction. These systems are designed to distinguish between human users and automated bots effectively.

Strategies for Solving Cloudflare Challenges

  1. Automated Browsers:

    • Tools like Selenium or Puppeteer can simulate real user interactions. To mask their automated nature, plugins such as puppeteer-extra-plugin-stealth can be used to pass the Cloudflare Challenge by emulating natural browser behavior.
  2. High-Quality Proxies:

    • Utilizing residential proxies that rotate IP addresses can help mimic genuine user access patterns, thereby reducing the likelihood of being blocked by Cloudflare's security measures.
  3. CAPTCHA Solving Services:

    • For challenges / captchas that require solving

Detailed Guide to solving Cloudflare Challenge

First, let's take a look of how cloudflare challenge looks like:

Sometimes, this page could have turnstile

Redeem Your CapSolver Bonus Code

Don’t miss the chance to further optimize your operations! Use the bonus code CAP26 when topping up your CapSolver account and receive an extra 5% bonus on each recharge, with no limits. Visit the CapSolver Dashboard to redeem your bonus now!

If have a similar page where you must wait until the verification is completed and usually have additional checks with turnstile, then it's cloudflare challenge.
There are some requeriments for solve this type of challenge:

  • Token returned in the response of the method getTaskResult is the value of the cookie cf_clearance that you will need to create.
  • Must use the same user-agent that the method getTaskResult return
  • Must use the same proxy IP used for solve the challenge
  • Must use the cookies of the response
  • Must use the headers of the response
  • Use TLS chrome 120 version

Example of how to solve cloudflare 5s interface with Python

python Copy
# -*- coding: utf-8 -*-
import time
import requests
import tls_client

API_KEY = ""  # TODO: your api key
page_url = ''  # TODO: your page url 'https://example.com
proxy = ""  # TODO: your proxy


def call_capsolver():
    data = {
        "clientKey": API_KEY,
        "task": {
            "type": 'AntiCloudflareTask',
            "websiteURL": page_url,
            "proxy": proxy,
        }
    }
    uri = 'https://api.capsolver.com/createTask'
    res = requests.post(uri, json=data)
    resp = res.json()
    task_id = resp.get('taskId')
    if not task_id:
        print("no get taskId:", res.text)
        return
    print('created taskId:', task_id)

    while True:
        time.sleep(1)
        data = {
            "clientKey": API_KEY,
            "taskId": task_id
        }
        response = requests.post('https://api.capsolver.com/getTaskResult', json=data)
        resp = response.json()
        status = resp.get('status', '')
        if status == "ready":
            print("successfully => ", response.text)
            return resp.get('solution')
        if status == "failed" or resp.get("errorId"):
            print("failed! => ", response.text)
            return


def request_site(solution):
    # TODO if you want to use tls_client
    session = tls_client.Session(
         client_identifier="chrome_120",
        random_tls_extension_order=True
    )
    return session.get(
        page_url,
        headers=solution.get('headers'),
        cookies=solution.get('cookies'),
        proxy=proxy,
        allow_redirects=True,
    )


def main():
    # first request:
    res = request_site({})
    print('1. response status code:', res.status_code)
    if res.status_code != 403:
        print("your proxy is good and didn't get the cloudflare challenge")
        return
    elif 'window._cf_chl_opt' not in res.text:
        print('==== proxy blocked ==== ')
        return

    # call capSolver:
    solution = call_capsolver()
    if not solution:
        return

    # second request (verify solution):
    res = request_site(solution)
    print('2. response status code:', res.status_code)
    if res.status_code == 200:
        ##print("2. response text:\n", res.text)
        print("successfully passed the cloudflare challenge")


if __name__ == '__main__':
    main()

Detailed Guide to solving Cloudflare Turnstile Captcha

Cloudflare offer 3 types of cloudflare turnstile captcha

  • Managed challenge

  • Non-interactive challenge

  • Invisible challenge
    not visible, you can check on the network / scripts loaded and see if turnstile is used

Turnstile CAPTCHA is Cloudflare’s replacement for traditional CAPTCHA challenges, focusing on user experience and security. Here’s how to approach solving it:

  1. Understand the Challenge:

    • Turnstile CAPTCHA might not always appear visibly; sometimes, it operates in the background, analyzing user interactions to verify authenticity.
  2. Integration of CAPTCHA Solving APIs:

    • Some CAPTCHA solving services have begun offering solutions for Turnstile by analyzing network traffic and interaction patterns. Utilize these APIs to submit Turnstile challenges for resolution.
  3. Maintain Browser Consistency:

    • Ensure that your automated solutions maintain consistent browser signatures, as Turnstile can analyze these to detect automation.
  4. Adapt to JavaScript Challenges:

    • Cloudflare may deploy JavaScript computations to test the browser's environment. Tools like Puppeteer can be scripted to solve these challenges dynamically by executing JavaScript code as a regular browser would.

Example of how to solve cloudflare turnstile captcha with Python

python Copy
import time
from curl_cffi import requests

CAPSOLVER_API_KEY = "Your CAPSOLVER.COM API KEY"
PAGE_URL = ""
WEBSITE_KEY = ""

def solvecf(metadata_action=None, metadata_cdata=None):
    url = "https://api.capsolver.com/createTask"
    task = {
        "type": "AntiTurnstileTaskProxyLess",
        "websiteURL": PAGE_URL,
        "websiteKey": WEBSITE_KEY,
    }
    if metadata_action or metadata_cdata:
        task["metadata"] = {}
        if metadata_action:
            task["metadata"]["action"] = metadata_action
        if metadata_cdata:
            task["metadata"]["cdata"] = metadata_cdata
    data = {
        "clientKey": CAPSOLVER_API_KEY,
        "task": task
    }
    response_data = requests.post(url, json=data).json()
    print(response_data)
    return response_data['taskId']


def solutionGet(taskId):
    url = "https://api.capsolver.com/getTaskResult"
    status = ""
    while status != "ready":
        data = {"clientKey": CAPSOLVER_API_KEY, "taskId": taskId}
        response_data = requests.post(url, json=data).json()
        print(response_data)
        status = response_data.get('status', '')
        print(status)
        if status == "ready":
            return response_data['solution']

        time.sleep(2)


def main():
    start_time = time.time()
    
    taskId = solvecf()
    solution = solutionGet(taskId)
    if solution:
        user_agent = solution['userAgent']
        token = solution['token']

    print("User_Agent:", user_agent)
    print("Solved Turnstile Captcha, token:", token)

    end_time = time.time()
    elapsed_time = end_time - start_time
    print(f"Time to solve the captcha: {elapsed_time} seconds")

if __name__ == "__main__":
    main()

Example of how to solve cloudflare turnstile captcha with Nodejs

js Copy
const axios = require('axios');

const CAPSOLVER_API_KEY = "";
const PAGE_URL = "";
const WEBSITE_KEY = "";

async function solvecf(metadata_action = null, metadata_cdata = null) {
    const url = "https://api.capsolver.com/createTask";
    const task = {
        type: "AntiTurnstileTaskProxyLess",
        websiteURL: PAGE_URL,
        websiteKey: WEBSITE_KEY,
    };
    if (metadata_action || metadata_cdata) {
        task.metadata = {};
        if (metadata_action) {
            task.metadata.action = metadata_action;
        }
        if (metadata_cdata) {
            task.metadata.cdata = metadata_cdata;
        }
    }
    const data = {
        clientKey: CAPSOLVER_API_KEY,
        task: task
    };
    const response = await axios.post(url, data);
    console.log(response.data);
    return response.data.taskId;
}

async function solutionGet(taskId) {
    const url = "https://api.capsolver.com/getTaskResult";
    let status = "";
    while (status !== "ready") {
        const data = { clientKey: CAPSOLVER_API_KEY, taskId: taskId };
        const response = await axios.post(url, data);
        console.log(response.data);
        status = response.data.status;
        console.log(status);
        if (status === "ready") {
            return response.data.solution;
        }
        await new Promise(resolve => setTimeout(resolve, 2000));
    }
}

async function main() {
    const start_time = Date.now();
    
    const taskId = await solvecf();
    const solution = await solutionGet(taskId);
    if (solution) {
        const user_agent = solution.userAgent;
        const token = solution.token;

        console.log("User_Agent:", user_agent);
        console.log("Solved Turnstile Captcha, token:", token);
    }

    const end_time = Date.now();
    const elapsed_time = (end_time - start_time) / 1000;
    console.log(`Time to solve the captcha: ${elapsed_time} seconds`);
}

main().catch(console.error);

Conclusion

Cloudflare’s security measures, including the Challenge and Turnstile CAPTCHA, are designed to protect websites from automated access while minimizing friction for legitimate users. For developers, testers, or businesses that require automated access for legitimate purposes, understanding these challenges and using robust solutions is key.

By combining high-quality proxies, browser automation with stealth techniques, and dedicated CAPTCHA-solving services like CapSolver , you can reliably bypass Cloudflare protections. The provided Python and Node.js examples demonstrate how to integrate CapSolver to handle both traditional Cloudflare challenges and Turnstile CAPTCHAs efficiently.

With proper implementation, automation workflows can achieve high success rates while maintaining compliance and minimizing detection.


FAQ

Q1: What is the difference between Cloudflare Challenge and Turnstile CAPTCHA?
A1: The Cloudflare Challenge often involves JavaScript checks or visible CAPTCHAs to verify humans. Turnstile is Cloudflare’s newer, user-friendly CAPTCHA that may run invisibly in the background, reducing user interaction while still verifying authenticity.

Q2: Can Turnstile CAPTCHA be solved programmatically?
A2: Yes. Services like CapSolver analyze network traffic and user interactions to solve Turnstile challenges, either in visible or invisible forms.

Q3: Do I need to rotate proxies when solving Cloudflare CAPTCHAs?
A3: Using residential or high-quality rotating proxies is highly recommended. Cloudflare tracks IP behavior, so consistent IP usage reduces the risk of blocks.

Q4: Can I use the same browser session for multiple challenges?
A4: It’s best to maintain browser consistency per session, using the same user-agent, cookies, headers, and TLS version, as mismatches can trigger Cloudflare security.

Q5: How fast can CapSolver solve Cloudflare Turnstile CAPTCHA?
A5: CapSolver typically solves most Cloudflare challenges in a few seconds (often ~5s), depending on network conditions, proxy quality, and task complexity.

Q6: Are there official libraries/examples to integrate CapSolver?
A6: Yes, CapSolver provides official examples for Python and Node.js, as shown in the article, covering both Cloudflare Challenge and Turnstile CAPTCHA.

More

CloudflareApr 21, 2026

Cloudflare Turnstile Verification Failed? Causes, Fixes & Troubleshooting Guide

Learn how to fix the "failed to verify cloudflare turnstile token" error. This guide covers causes, troubleshooting steps, and how to defeat cloudflare turnstile with CapSolver.

Emma Foster
Emma Foster
CloudflareApr 20, 2026

Best Cloudflare Challenge Solver Tools: Comparison & Use Cases

Discover the best cloudflare challenge solver tools, compare API vs. manual automation, and find optimal solutions for your web scraping and automation needs. Learn why CapSolver is a top choice.

Ethan Collins
Ethan Collins
CloudflareApr 16, 2026

How to Solve Cloudflare Turnstile in Vehicle Data Automation

Learn how to handle Cloudflare Turnstile in vehicle data and public records automation. Use CapSolver and n8n to automate record scraping efficiently.

Lucas Mitchell
Lucas Mitchell
CloudflareApr 14, 2026

CAPTCHA Error 600010: What It Means and How to Fix It Fast

Facing CAPTCHA Error 600010? Learn what this Cloudflare Turnstile error means and get step-by-step solutions for users and developers, including CapSolver integration for automation.

Anh Tuan
Anh Tuan

Contents

Blog
Cloudflare