If you're trying to automate anything on the web, sooner or later you hit a CAPTCHA. They block bots, stop scripts, and basically freeze your workflow.
2Captcha is a service that solves those CAPTCHAs for you so your automation can keep running without interruptions.
This guide will show you, in a very practical way, how to start using 2Captcha and integrate it into your scripts.
What Exactly Is 2Captcha?
Think of it as a bridge between your script and the CAPTCHA challenge.
You send the CAPTCHA to 2Captcha → human workers solve it → your script gets the answer → your automation continues.
It works with many types of CAPTCHAs, including:
- Google reCAPTCHA v2 and v3
- hCaptcha
- FunCaptcha (Arkose Labs)
- Invisible reCAPTCHA
- Cloudflare Turnstile
- Classic image CAPTCHAs (letters, numbers, symbols)
- Simple text puzzles
- Mathematical CAPTCHAs
Basically, if your bot is stuck because of validation on a website, 2Captcha can likely handle it.
Where You Can Use It
Here are typical situations where people use 2Captcha:
- Automating account creation
- Performing scraping or crawling on big sites
- Checking prices, product availability, and SEO metrics
- Filling out forms automatically
- Logging into websites that require CAPTCHA verification
- Running browser automation using Selenium, Puppeteer, or Playwright If you work with bots or automation tools, you will eventually need a CAPTCHA solver.
How to Start Using 2Captcha (Step by Step)
1. Sign Up
Go to 2captcha.com and create an account.
Takes less than a minute.
2. Add Funds
Solving CAPTCHAs costs money, but the price is tiny.
A few dollars is enough to process thousands of CAPTCHAs.
3. Copy Your API Key
After logging in, open your dashboard and copy your API key.
This key authorizes your requests to the service.
You’ll place this key inside your scripts.
How the API Works
No matter what type of CAPTCHA you solve, the process always looks like this:
Upload the CAPTCHA (or send site key + URL)
- Receive a job ID
- Wait a few seconds
- Request the result using the job ID
- Get the answer and submit it on the website Simple pattern, but you must follow it strictly.
Code Examples
Below are fresh examples written cleanly and simply.
Example 1: Solving reCAPTCHA v2 (Python)
import requests
import time
API_KEY = "YOUR_2CAPTCHA_API_KEY"
PAGE_URL = "https://example.com"
SITE_KEY = "SITE_KEY_FROM_WEBSITE"
Submit a new captcha task
r = requests.post("http://2captcha.com/in.php", data={
"key": API_KEY,
"method": "userrecaptcha",
"googlekey": SITE_KEY,
"pageurl": PAGE_URL
})
task_id = r.text.split("|")[1]
Poll until ready
solution = None
while True:
check = requests.get("http://2captcha.com/res.php", params={
"key": API_KEY,
"action": "get",
"id": task_id
})
if check.text.startswith("OK|"):
solution = check.text.split("|")[1]
break
time.sleep(5)
print("Token:", solution)
You take that token and inject it into your form or Selenium script.
Example 2: Solving an Image CAPTCHA (Node.js)
const axios = require("axios");
const fs = require("fs");
const API_KEY = "YOUR_API_KEY";
(async () => {
const imageBase64 = fs.readFileSync("captcha.jpg", "base64");
const send = await axios.post("http://2captcha.com/in.php", null, {
params: {
key: API_KEY,
method: "base64",
body: imageBase64
}
});
const id = send.data.split("|")[1];
// Poll for result
let result;
while (true) {
const res = await axios.get("http://2captcha.com/res.php", {
params: { key: API_KEY, action: "get", id }
});
if (res.data.includes("OK|")) {
result = res.data.split("|")[1];
break;
}
await new Promise(r => setTimeout(r, 5000));
}
console.log("Answer:", result);
})();
This solves traditional CAPTCHAs with characters.
Useful Tips to Get Better Results
- Wait at least 4–6 seconds before checking the solution
Monitor error messages like:
-CAPCHA_NOT_READY
-ERROR_KEY_DOES_NOT_EXIST
-ERROR_WRONG_USER_KEYFor heavy workloads, use asynchronous requests
Don’t hard-code your API key in public scripts
Use json=1 parameter to receive structured JSON responses
When You Should Avoid Using 2Captcha
2Captcha should not be used for:
- Illegal or unethical activities
- Bypassing security of personal accounts
- Banking or financial login automation
- Activities that violate websites' terms of service
Stick to legal, benign automation tasks.
Conclusion
2Captcha is a simple, affordable, and flexible way to handle CAPTCHA challenges in your automation scripts.
Once you understand the basic request → wait → retrieve flow, integrating it into your code becomes straightforward.

Top comments (0)