Image/text CAPTCHA solving can fail due to image quality, format issues, or incorrect hint parameters. Here is how to diagnose and fix the most common errors.
Submission errors
ERROR_WRONG_FILE_EXTENSION
Cause: The image is not in a supported format or the base64 is invalid.
Fix:
import base64
# Ensure proper encoding
with open("captcha.png", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
# Don't include the data URI prefix
# WRONG: "data:image/png;base64,iVBOR..."
# RIGHT: "iVBOR..."
ERROR_ZERO_CAPTCHA_FILESIZE
Cause: The image file is empty or the download failed.
Fix:
import os
# Check file size before submitting
if os.path.getsize("captcha.png") == 0:
print("Image file is empty — re-download")
# Re-capture the captcha
ERROR_TOO_BIG_CAPTCHA_FILESIZE
Cause: Image exceeds maximum size (typically 600KB).
Fix:
from PIL import Image
import io
img = Image.open("captcha.png")
# Reduce quality without losing text clarity
buffer = io.BytesIO()
img.save(buffer, format="PNG", optimize=True)
Wrong text returned
Characters consistently misread
Cause: The solver confuses similar characters (0/O, 1/l/I, 5/S).
Fix: Use hint parameters to constrain the character set:
# If captcha is digits only
response = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY, "method": "base64", "body": b64,
"numeric": 1, # 1 = digits only
"json": 1
})
# If captcha is letters only
response = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY, "method": "base64", "body": b64,
"numeric": 2, # 2 = letters only
"json": 1
})
Wrong case (uppercase vs lowercase)
Cause: The solver defaults to lowercase.
Fix: Set regsense=1 to enable case sensitivity:
response = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY, "method": "base64", "body": b64,
"regsense": 1, # Case-sensitive
"json": 1
})
Extra or missing characters
Cause: Noise is interpreted as characters, or characters are merged.
Fix: Set min/max length constraints:
# If you know the CAPTCHA is always 6 characters
response = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY, "method": "base64", "body": b64,
"min_len": 6,
"max_len": 6,
"json": 1
})
Math expression not computed
Cause: The solver reads the text "3+7" instead of computing the answer "10".
Fix: Set calc=1:
response = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY, "method": "base64", "body": b64,
"calc": 1, # Compute the math expression
"json": 1
})
Image quality issues
CAPTCHA too small
Problem: Very small images (under 50px height) lose character detail.
Fix: Capture at the largest available size. If the page renders the captcha small, check for a higher-resolution source URL:
# Check for higher-res version
img_src = captcha_el.get_attribute("src")
# Some sites use ?size=small — try removing or changing the parameter
high_res_src = img_src.replace("size=small", "size=large")
CAPTCHA is animated
Problem: Some CAPTCHAs use animated GIFs where the text is only visible in certain frames.
Fix: Extract the correct frame:
from PIL import Image
gif = Image.open("captcha.gif")
# Extract each frame and find the one with text
for i in range(gif.n_frames):
gif.seek(i)
gif.save(f"frame_{i}.png")
CAPTCHA has transparent background
Problem: PNG with transparent background may not render correctly for OCR.
Fix: Add a white background:
from PIL import Image
img = Image.open("captcha.png").convert("RGBA")
background = Image.new("RGBA", img.size, (255, 255, 255, 255))
background.paste(img, mask=img)
background.convert("RGB").save("captcha_white_bg.png")
Reporting incorrect solutions
If CaptchaAI returns the wrong text, report it:
# Report bad answer
requests.get("https://ocr.captchaai.com/res.php", params={
"key": API_KEY,
"action": "reportbad",
"id": task_id
})
This improves solver accuracy and may refund the solve cost.
Accuracy improvement checklist
| Parameter | When to use | Effect |
|---|---|---|
numeric=1 |
Digits only | Eliminates letter/digit confusion |
numeric=2 |
Letters only | Eliminates letter/digit confusion |
min_len / max_len |
Known length | Prevents extra/missing characters |
regsense=1 |
Case matters | Preserves uppercase/lowercase |
calc=1 |
Math expression | Returns computed answer |
phrase=1 |
Contains spaces | Allows multi-word answers |
language=1 |
Cyrillic text | Uses correct character set |
language=2 |
Latin text | Uses correct character set |
FAQ
Why is my CAPTCHA always wrong by one character?
Use min_len and max_len to constrain the answer length. Also verify the image quality — blurry images cause misreads.
Should I use file upload or base64?
Both work equally well. Base64 is convenient for programmatic use; file upload works better with multipart form tools.
How do I solve CAPTCHAs in other languages?
Set the language parameter: 1 for Cyrillic, 2 for Latin. For other scripts, omit the parameter and let the solver detect automatically.
Can I solve audio CAPTCHAs with this method?
No. Audio CAPTCHAs require a different solving approach. Check CaptchaAI documentation for audio CAPTCHA support.
Discussions (0)
Join the conversation
Sign in to share your opinion.
Sign InNo comments yet.