DEV Community

Markus
Markus

Posted on

How to Bypass CAPTCHA: Fast and Without PRO Technical Experience

Automation can be exhausting, especially if you’re new to it and facing "interesting" or "non-standard" challenges—read: tough or seemingly impossible ones. Let’s not get into why a task is considered "interesting" or "non-standard"; instead, let’s focus on one problem that stops about 50% of inexperienced automators in their tracks: How to bypass CAPTCHA!

Image description

What Is CAPTCHA and What Do You Need to Skip CAPTCHA? A Quick Introduction

There are tons of articles about CAPTCHA already. If you want a detailed explanation, I highly recommend the article Understanding CAPTCHA Recognition: Breaking Down a Complex Process in the Simplest Terms.

In short, CAPTCHA is a method used to protect services (websites or apps) from bots and spammers.

How does it protect them? Now that’s a great question! CAPTCHA comes in various forms, and there’s even a classification system for them (referenced in the article linked above). It challenges users with simple tasks—finding specific images, typing a displayed word, or clicking a checkbox, for example. These methods all work, some better than others. Since people keep searching for “how to bypass CAPTCHA verification,” it’s safe to say they’re effective and will remain so (here’s my prediction: at least until the end of next year).

Image description

The harder the CAPTCHA, the tougher it is to bypass. And the tougher it is to bypass, the more nuances and complexities you’ll need to account for.

Common Problems Automators Face When Working with Websites: Beyond the Need to Bypass CAPTCHA

There’s a set of standard issues automators encounter, especially during high-volume operations:

  • IP-Based Restrictions
    If too many requests originate from the same IP address, the service (website) may flag this as suspicious and trigger a CAPTCHA. Some services even maintain blacklists of IP addresses, often associated with datacenter proxies. Moreover, if the same IP repeatedly encounters CAPTCHAs (due to frequent requests), it could get banned or restricted. At best, this increases your CAPTCHA-solving costs; at worst, the service becomes completely inaccessible from that IP.

  • Detection of Automated Actions
    Websites have algorithms to detect patterns like identical time intervals between requests or repetitive visits to the same pages. Additionally, using outdated or incorrect User-Agent headers can expose automation efforts. This can lead to CAPTCHAs, IP bans, or other restrictions.

  • CAPTCHA Appearance
    Modern CAPTCHAs have evolved significantly—from simple text-based challenges to image selection, audio tasks, and invisible solutions like Google reCAPTCHA v3. Platforms like Cloudflare can detect suspicious behavior and issue challenges without showing a visible CAPTCHA. Sometimes, CAPTCHA appears by default for all visitors, not just suspected bots, making it a universal problem.

  • Honeypots and Anti-Bot Technologies
    Some websites use hidden fields or elements (honeypots) to identify bots. These traps are common in large-scale projects but can also be found on smaller platforms. Improper interaction with such elements flags automation, leading to the issues described above.

Image description

The Consequences of CAPTCHA and Related Problems: How to Bypass CAPTCHA and Avoid Common Setbacks

Here’s what happens when you encounter these issues:

  • Delays in data processing: Each CAPTCHA slows down your automation process.

  • Reduced efficiency: Failing to solve CAPTCHA leads to lost requests.

  • Increased costs: Mass usage of CAPTCHA-solving APIs or proxies drives up expenses.

  • IP or account bans: Frequent CAPTCHA triggers can result in your IP addresses or accounts being blocked.

Practical Tips: What will be better Bypass CAPTCHA or Prevent CAPTCHA

Let’s dive into specific methods to address CAPTCHA effectively.

  1. IP Rotation - It Won't Bypass CAPTCHA but It Will Help Prevent It

CAPTCHA often appears when too many requests originate from the same IP. The solution? Proxy rotation.

How It Works:

  • Proxies mask your real IP address, making requests appear as if they’re coming from different users.
  • Each new request uses a different IP, reducing the suspicion of bot activity.

Types of Proxies:

  • Residential Proxies: IPs assigned to real devices in homes. They’re less likely to raise suspicion but are more expensive.
  • Datacenter Proxies: Cheaper and provided by data centers, but more easily flagged as automated.
  • Mobile Proxies: The most reliable option, using IPs from mobile networks, but also the most costly.

Python Example for Proxy Rotation:

import requests
import itertools

# List of proxies
proxy_list = [
    {"http": "http://27.64.18.8:10004", "https": "http://27.64.18.8:10004"},
    {"http": "http://161.35.70.249:3128", "https": "http://161.35.70.249:3129"},
]

# Proxy rotator
def proxy_rotator(proxies):
    return itertools.cycle(proxies)

proxy_gen = proxy_rotator(proxy_list)

# Example request with proxy rotation
for _ in range(3):
    proxy = next(proxy_gen)
    response = requests.get("https://httpbin.org/ip", proxies=proxy)
    print(response.text)
Enter fullscreen mode Exit fullscreen mode

Image description

  1. User-Agent Rotation - Second Way to Prevent CAPTCHA (In Bypassing CAPTCHA It Works Too)

Using the same User-Agent string repeatedly is a red flag for services. Rotating these headers makes requests look more natural.

How It Works:

  • Use popular User-Agent strings to mimic different devices and browsers.
  • Regularly change the User-Agent for each request.

Python Example for User-Agent Rotation:

import requests
import itertools

# List of User-Agent strings
user_agent_list = [
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0",
]

# User-Agent rotator
def rotate_ua(user_agents):
    return itertools.cycle(user_agents)

ua_gen = rotate_ua(user_agent_list)

# Example request with User-Agent rotation
for _ in range(3):
    headers = {"User-Agent": next(ua_gen)}
    response = requests.get("https://httpbin.org/user-agent", headers=headers)
    print(response.text)
Enter fullscreen mode Exit fullscreen mode
  1. Simulating Human Behavior - Best Way to Use with CAPTCHA Bypassing If It Didn’t Help To Prevent It

Websites often flag automation when interactions don’t mimic real users. Adding randomness to requests and simulating user actions can help avoid detection.

Python Example Using Delays:

import time
import random
import requests

urls = [
    "https://httpbin.org/get?page=1",
    "https://httpbin.org/get?page=2",
    "https://httpbin.org/get?page=3",
]

for url in urls:
    response = requests.get(url)
    print(f"Response from {url}: {response.status_code}")
    delay = random.uniform(1, 5)
    print(f"Waiting for {delay:.2f} seconds...")
    time.sleep(delay)
Enter fullscreen mode Exit fullscreen mode

Example with Selenium for Simulating User Actions:

from selenium import webdriver
import time

driver = webdriver.Chrome()

driver.get("https://example.com")
time.sleep(2)

# Scroll action
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(2)

# Click action
element = driver.find_element_by_id("some_id")
element.click()
time.sleep(2)

driver.quit()
Enter fullscreen mode Exit fullscreen mode

Image description
_

CAPTCHA: You are acting like a bot.
Me: Adding random delays between actions.
CAPTCHA: Still a bot.
_

Solving CAPTCHA Directly - If You Can’t Prevent - You Should Bypass CAPTCHA

If all else fails and CAPTCHA still appears, services like 2Captcha and SolveCaptcha provide APIs for solving them programmatically. You can integrate these APIs into your workflow or use prebuilt Python modules available on GitHub.

How to Bypass CAPTCHA Human Verification: Ready Methods

Automation, much like CAPTCHA itself, varies in complexity. Sometimes, it’s just about looping a simple repetitive task, and other times, it’s about scaling up operations like registering email accounts en masse. Similarly, CAPTCHAs range in difficulty, but as the saying goes: if CAPTCHA is inevitable, solve it first!

Here are the key methods to bypass CAPTCHA:

  • CAPTCHA-solving services
  • OCR algorithms
  • Headless browsers

Image description

How to Solve CAPTCHA Using Third-Party Services

There are countless CAPTCHA-solving services like 2Captcha and SolveCaptcha. These platforms provide direct integration via APIs and even ready-to-use modules available on GitHub.

Direct API Integration:

This requires stronger programming skills, as you’ll need to understand service documentation, which can often be riddled with complexities.
Speaking from experience, tackling an API’s documentation without at least basic programming knowledge feels like deciphering an elven manuscript. However, with time and practice, you can learn to extract the parameters you need.

Prebuilt Modules:

If APIs seem daunting, prebuilt modules simplify things significantly. For this demonstration, I used the module captcha-solver-selenium-python-examples. It integrates several CAPTCHA solvers for different types of CAPTCHAs.

I created a short video showcasing how to solve three types of CAPTCHAs: coordinate-based, text-based, and reCAPTCHA V2. I intentionally left the module unmodified to show it works straight out of the box. Keep in mind, however, that this module solves CAPTCHAs from demo pages. To make it work on a different site, you’ll likely need to adapt the module (at minimum, updating the URL containing the CAPTCHA).

Another point worth mentioning: I directly included the CAPTCHA-solving API key in the module for this demo. By default, the module is set up to load the key from a file, but I prefer this approach to avoid potential file-loading issues I’ve encountered in the past.

Video Walkthrough

The video demonstrates that, with minimal preparation (as described above), the module functions like a universal tool:

  • Need to solve a text-based CAPTCHA? Use the “text CAPTCHA” example in the module!
  • Need to solve reCAPTCHA V2? Use the “reCAPTCHA V2” example!

I trust you’ve got the gist of the workflow by now.

Comparison: Preventing CAPTCHA vs. Solving CAPTCHA

To determine the most efficient approach, you need to answer a simple question: Is saving money or time more important to you?

Both prevention and solving involve costs:

  • Preventing CAPTCHA can extend project timelines or inflate budgets (e.g., quality proxies aren’t cheap).
  • Solving CAPTCHA may save time but introduces additional costs for services.

Let’s compare the described methods and add a third option: a hybrid approach.

Approach 1: Preventing CAPTCHA Appearance How to Bypass CAPTCHA Without Bypassing CAPTCHA?

Summary: Utilize IP rotation, User-Agent switching, cookie management, and headless browsers to circumvent anti-bot mechanisms.

Advantages:

  • Cost Savings:

  • If you already have an infrastructure for rotation (e.g., private proxies or free Tor nodes), expenses are minimal.

  • No need to purchase CAPTCHA-solving solutions or API services.

  • Efficiency:

  • In some cases, CAPTCHA appearance can be entirely avoided, especially with low request intensity.

  • High data processing speed is maintained without CAPTCHA-solving delays.

Disadvantages:

  • Dependence on Proxy Quality:
  • Free proxies may be unreliable or slow, while premium proxies can be costly (starting at ~$0.5 per IP for a good pool).

  • Setup Complexity:

  • Fine-tuning rotation and simulating user behavior requires expertise.

Example:

For scraping a small site with minimal protection, this method can be cost-effective—around ~$50/month for proxies.

Approach 2: Solving CAPTCHA - Standart Method to Bypass CAPTCHA

Summary: Instead of avoiding CAPTCHA, use APIs (e.g., 2Captcha, SolveCaptcha) or custom ML models to solve them.

Advantages:

  • Cost Savings:
  • No need to buy premium proxies or implement complex prevention logic.
  • Solving CAPTCHAs via APIs costs ~$0.5–$1 per 1,000 CAPTCHAs, making it budget-friendly for small-scale tasks.

  • Efficiency:

  • Ideal for CAPTCHAs that are challenging to prevent (e.g., reCAPTCHA v2/v3).

  • Eliminates the need for advanced work with User-Agent headers or cookies.

Disadvantages:

  • High Costs for Large Volumes:
  • For projects involving millions of requests, expenses can grow exponentially.

  • Delays:

  • API-based CAPTCHA-solving can take 5–20 seconds per request, slowing down workflows.

Example:

For scraping large marketplaces with frequent CAPTCHAs, costs could reach ~$100 for 100,000 CAPTCHAs.

Approach 3: Combining Prevention and Solving - Double Hit CAPTCHA

Summary: A hybrid strategy where prevention methods minimize CAPTCHA appearances, while solving serves as a fallback.

Image description

Advantages:

  • Cost Savings:
  • The number of CAPTCHAs to solve is significantly reduced with IP/User-Agent rotation.
  • Less reliance on API services for high-volume requests.

  • Efficiency:

  • Universality: Can handle websites with varying levels of protection.

  • Flexibility: Prevention reduces the risk of bans, while solving addresses any remaining challenges.

Disadvantages:

  • Implementation Complexity:
  • Requires maintaining both prevention and solving systems.

  • Moderate Costs:

  • More expensive than using either approach alone, but often optimal overall.

Example:

For a large-scale project with 1,000,000 requests/month:

  • Proxies cost ~$500.
  • Solving 10% of CAPTCHAs via API adds ~$100.
  • Total cost: ~$600 for high stability.

Summary Table

| **Approach**        | **Budget-Friendly**                         | **Efficient**                         | **Best Use Case**                               |
|---------------------|---------------------------------------------|---------------------------------------|------------------------------------------------|
| **Prevention**       | Low-cost initial setup, minimal upkeep      | Fast for simple tasks, lightweight    | Small websites with infrequent CAPTCHA calls    |
| **Solving**          | Cheap for low-volume tasks                  | Universal but slower solution         | High-security sites with frequent CAPTCHA challenges |
| **Hybrid**           | Moderate cost, combined approach            | Optimized for stability and speed across scenarios | Large-scale projects with fluctuating CAPTCHA volumes and security levels |
Enter fullscreen mode Exit fullscreen mode

Recommendation

For large-scale projects, a hybrid approach is optimal—combining IP/User-Agent rotation with fallback CAPTCHA-solving.

Final Thoughts

The question, “how to solve CAPTCHA during automation or scraping,” is complex. The straightforward answer may not fully meet your needs. A more precise question is, “how to use tools effectively for preventing and solving CAPTCHA to reduce costs and increase efficiency?”

Image description

This article aims to provide a detailed response with examples and comparisons to help you make informed decisions.

Top comments (0)