How to Solve reCAPTCHA v2 with Python

Ethan Collins
Pattern Recognition Specialist
19-Sep-2023

TL;DR
- This guide shows how to solve reCAPTCHA v2 using Python and CapSolver, with both Proxy and Proxyless task types.
- Includes deeper explanations, common troubleshooting tips, and expanded examples for real-world automation scenarios.
- Ideal for developers working on scraping, SEO automation, SERP data extraction, form-filling bots, and CI testing pipelines.
Introduction
Google reCAPTCHA v2 is widely used to block automated traffic.
If you’re building scrapers, automation workflows, account creators, online form submitters, or SERP tools, solving reCAPTCHA v2 is practically mandatory.
This expanded guide walks you through:
- Installation
- How each task type works
- Detailed Python examples
- When to use proxy / proxyless
- Error handling
- Key implementation notes for high-value targets
⚙️ Prerequisites
- A working proxy (Optional, read both examples, as one require proxy and other don't require)
- Python installed
- CapSolver API key
🤖 Install Necessary Packages
Execute the following commands to install the required packages:
python
pip install capsolver
👨💻 Python Code for solve reCaptcha v2 with your proxy
Here's a Python sample script to accomplish the task:
python
import capsolver
# Consider using environment variables for sensitive information
PROXY = "http://username:password@host:port"
capsolver.api_key = "Your Capsolver API Key"
PAGE_URL = "PAGE_URL"
PAGE_KEY = "PAGE_SITE_KEY"
def solve_recaptcha_v2(url,key):
solution = capsolver.solve({
"type": "ReCaptchaV2Task",
"websiteURL": url,
"websiteKey":key,
"proxy": PROXY
})
return solution
def main():
print("Solving reCaptcha v2")
solution = solve_recaptcha_v2(PAGE_URL, PAGE_KEY)
print("Solution: ", solution)
if __name__ == "__main__":
main()
👨💻 Python Code for solve reCaptcha v2 without proxy
Here's a Python sample script to accomplish the task:
python
import capsolver
# Consider using environment variables for sensitive information
capsolver.api_key = "Your Capsolver API Key"
PAGE_URL = "PAGE_URL"
PAGE_KEY = "PAGE_SITE_KEY"
def solve_recaptcha_v2(url,key):
solution = capsolver.solve({
"type": "ReCaptchaV2TaskProxyless",
"websiteURL": url,
"websiteKey":key,
})
return solution
def main():
print("Solving reCaptcha v2")
solution = solve_recaptcha_v2(PAGE_URL, PAGE_KEY)
print("Solution: ", solution)
if __name__ == "__main__":
main()
⚠️ Change these variables
- PROXY: Update with your proxy details. The format should be http://username:password@ip:port. ONLY REQUIRED with ReCaptchaV2Task
- capsolver.api_key: Obtain your API key from the Capsolver Dashboard.
- PAGE_URL: Replace with the URL of the website for which you wish to solve reCaptcha v2.
- PAGE_KEY: Replace with the SITEKEY of the website for which you wish to solve reCaptcha v2.
📌 Conclusion
Solving reCAPTCHA v2 reliably is essential for modern automation — whether you're running large-scale scraping pipelines, automating form submissions, performing SERP data extraction, or building custom AI agents that interact with the web. With CapSolver, the entire process becomes far more predictable, stable, and scalable.
By choosing the correct task type (Proxy vs Proxyless), validating your sitekeys, and ensuring your proxy setup is solid, you can achieve near-instant CAPTCHA resolutions with minimal overhead.
FAQ
1. Do I need a proxy for every website?
No — many websites work perfectly with the Proxyless task. You only need proxies for higher security targets (e.g., marketplaces, ticketing platforms, Google Search, login flows, etc.).
2. What type of proxy works best with reCAPTCHA v2?
Residential or ISP proxies deliver the best stability.
Datacenter proxies may work but often get flagged on high-value sites.
3. How fast does CapSolver return the token?
Most reCAPTCHA v2 tasks resolve in 1–5 seconds, depending on website difficulty and queue load.
4. Can I reuse the same token multiple times?
No. Each token is single-use and expires very quickly (usually within ~120 seconds).
👀 More information
- How to solve reCaptcha v3 and get a score 0.7-0.9 like a human
- Solve all types of reCaptcha v2 / v2 invisible / v2 enterprise / v3 / v3 enterprise
Boost your automation budget instantly!
Use bonus code CAPN when topping up your CapSolver account to get an extra 5% bonus on every recharge — with no limits.
Redeem it now in your CapSolver Dashboard
🧾 Key Takeaways
- Use ReCaptchaV2Task + good proxy for high-value targets.
- Use Proxyless only for less protected sites.
- CapSolver drastically simplifies integration — just call
capsolver.solve(). - reCAPTCHA v2 becomes stricter each year; stable solvers are essential for production workflows.
- Always verify sitekey and URL carefully — 90% of beginner mistakes come from incorrect sitekeys.
Compliance Disclaimer: The information provided on this blog is for informational purposes only. CapSolver is committed to compliance with all applicable laws and regulations. The use of the CapSolver network for illegal, fraudulent, or abusive activities is strictly prohibited and will be investigated. Our captcha-solving solutions enhance user experience while ensuring 100% compliance in helping solve captcha difficulties during public data crawling. We encourage responsible use of our services. For more information, please visit our Terms of Service and Privacy Policy.
More

Best reCAPTCHA Solver 2026 for Automation & Web Scraping
Discover the best reCAPTCHA solvers for automation and web scraping in 2026. Learn how they work, choose the right one, and stay ahead of bot detection.

Anh Tuan
14-Jan-2026

Top 5 Captcha Solvers for reCAPTCHA Recognition in 2026
Explore 2026's top 5 CAPTCHA solvers, including AI-driven CapSolver for fast reCAPTCHA recognition. Compare speed, pricing, and accuracy here

Lucas Mitchell
09-Jan-2026

Solving reCAPTCHA with AI Recognition in 2026
Explore how AI is transforming reCAPTCHA-solving, CapSolver's solutions, and the evolving landscape of CAPTCHA security in 2026.

Ethan Collins
08-Jan-2026

How to Identify and Obtain reCAPTCHA “s” Parameter Data
Learn to identify and obtain reCaptcha 's' data for effective captcha solving. Follow our step-by-step guide on using Capsolver's tools and techniques.

Ethan Collins
25-Nov-2025

How to Identify and Submit reCAPTCHA Extra Parameters (v2/v3/Enterprise) | CapSolver Guide
Learn how to detect and submit extra reCAPTCHA parameters using CapSolver to improve accuracy and solve complex challenges.

Rajinder Singh
10-Nov-2025

How to Solve reCAPTCHA When Scraping Search Results with Puppeteer
Master the art of Puppeteer web scraping by learning how to reliably solve reCAPTCHA v2 and v3. Discover the best puppeteer recaptcha solver techniques for large-scale data harvesting and SEO automation.

Lucas Mitchell
04-Nov-2025


