How to Use 2Captcha: A Simple Step-by-Step Guide (with Code Examples)

 


If you’ve ever tried to automate something on the web, you already know the pain: CAPTCHA walls everywhere.
2Captcha is one of the easiest services that helps you solve CAPTCHAs automatically using a cheap human-powered API.

This guide will walk you through everything you need to start using 2Captcha today.


1. What You Can Use 2Captcha For

2Captcha is useful for any task that requires automated interaction with sites protected by CAPTCHA. Examples:

You can use it for:

  • Automating account creation and registrations

  • Web scraping and crawling

  • Price monitoring

  • Checking SEO positions

  • Automating login flows

  • Working with form submissions

  • Bypassing:

    • Google reCAPTCHA v2 / v3

    • hCaptcha

    • FunCaptcha (Arkose Labs)

    • Image CAPTCHAs

    • Text CAPTCHAs

    • Cloudflare challenges (Turnstile)

If any automation script stops because of a CAPTCHA — 2Captcha helps.


2. How to Start Using 2Captcha

Step 1: Create an Account

Go to 2captcha.com and sign up.

Step 2: Add Balance

To solve CAPTCHAs automatically, you need funds.
Even $1–$3 is enough for testing. A single solve usually costs less than $0.001–$0.01.

Step 3: Find Your API Key

Once logged in:

  • Go to your account dashboard

  • Copy your API Key (you’ll need it in all scripts)


3. How Solving Works (Simple Explanation)

Using the API always follows this pattern:

  1. You send a CAPTCHA to be solved

  2. You receive an ID of your request

  3. You poll the server every few seconds

  4. You get the final answer (token or text)

This applies to reCAPTCHA, hCaptcha, image CAPTCHAs — everything.


4. Code Examples (Python, JavaScript)

Below are the simplest examples in Python and Node.js.


4.1 Solve Google reCAPTCHA v2 (Python)

import requests import time API_KEY = "YOUR_API_KEY" SITE_KEY = "SITE_KEY_FROM_WEBPAGE" URL = "https://example.com" # Step 1: send captcha resp = requests.post("http://2captcha.com/in.php", data={ "key": API_KEY, "method": "userrecaptcha", "googlekey": SITE_KEY, "pageurl": URL }) captcha_id = resp.text.split('|')[1] # Step 2: wait for solution solution = None while True: check = requests.get(f"http://2captcha.com/res.php?key={API_KEY}&action=get&id={captcha_id}") if "OK|" in check.text: solution = check.text.split('|')[1] break time.sleep(5) print("Captcha Solved:") print(solution)

Use the solution token in your browser automation (Selenium, Playwright, etc.).


4.2 Solve Google reCAPTCHA v2 (Node.js)

const axios = require("axios"); const API_KEY = "YOUR_API_KEY"; const SITE_KEY = "SITE_KEY_HERE"; const PAGE_URL = "https://example.com"; (async () => { const send = await axios.post("http://2captcha.com/in.php", null, { params: { key: API_KEY, method: "userrecaptcha", googlekey: SITE_KEY, pageurl: PAGE_URL } }); const captchaId = send.data.split('|')[1]; // Wait for solution let result; while (true) { const res = await axios.get("http://2captcha.com/res.php", { params: { key: API_KEY, action: "get", id: captchaId } }); if (res.data.includes("OK|")) { result = res.data.split('|')[1]; break; } await new Promise(r => setTimeout(r, 5000)); } console.log("Solution:", result); })();

4.3 Solve an Image CAPTCHA (Python)

import base64 import requests API_KEY = "YOUR_API_KEY" IMAGE_FILE = "captcha.jpg" with open(IMAGE_FILE, "rb") as f: b64 = base64.b64encode(f.read()).decode("utf-8") resp = requests.post("http://2captcha.com/in.php", data={ "key": API_KEY, "body": b64, "method": "base64" }) captcha_id = resp.text.split('|')[1] # Poll result while True: check = requests.get(f"http://2captcha.com/res.php?key={API_KEY}&action=get&id={captcha_id}") if "OK|" in check.text: print("Captcha text:", check.text.split('|')[1]) break

This solves old-style “type-the-letters” CAPTCHAs.


5. Tips for Using 2Captcha Efficiently

  • Always add a delay of 4–6 seconds before checking the result

  • Handle errors like CAPCHA_NOT_READY, ERROR_WRONG_USER_KEY, etc.

  • Store your API key securely

  • If solving takes too long, include:

    • soft_id=123 for priority

    • json=1 for convenient JSON responses

  • For heavy automation, use asynchronous queues


6. When Not to Use 2Captcha

Avoid using the service for:

  • CAPTCHA solving on banking or financial login workflows

  • Illegal or harmful automation

  • Bots meant to attack websites

Use it only for legitimate automation tasks.


7. Final Thoughts

2Captcha is one of the simplest CAPTCHA-solving APIs out there.
If you’re building any kind of automation — from SEO tools to account creation scripts — it’s a cheap and reliable helper.

Комментарии

Популярные сообщения из этого блога

How to Bypass reCAPTCHA v2 Using Tampermonkey and 2Captcha API

Roblox captcha solver

🤖 How I Outsmarted reCAPTCHA Using Greasy Fork and 2Captcha (Yes, Really)