captcha
A captcha library that generates audio and image CAPTCHAs.
What it is and what it does
Captcha is a library for generating audio and image CAPTCHAs—challenge-response tests used to verify that a user is human rather than a bot. It provides two separate modules: one for audio CAPTCHAs and one for image CAPTCHAs, each accepting a string to encode and outputting either a WAV file or PNG image. The library depends only on Pillow for image handling and supports Python 3.8 through 3.13.
The package is designed for developers building web applications or other systems that need human verification. It allows you to generate CAPTCHA data in memory or write it directly to files, and supports customization through your own voice and font data, though built-in data is available. The library has been in development since 2014 and remains in beta status; it is permissively licensed under BSD-3-Clause.
Use it for:
- Generate image CAPTCHAs for web form submission to prevent automated bot attacks.
- Create audio CAPTCHAs for accessibility compliance when image-based verification alone is insufficient.
- Build a custom bot-detection layer by embedding CAPTCHA generation into a web service or API.
- Integrate standalone CAPTCHA generation into a security workflow without relying on third-party services.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates audio and image CAPTCHAs for use in web applications and security workflows, with support for custom voice and font data.
Yes, if you need simple, self-hosted CAPTCHA generation without external service dependencies. The low install friction, permissive license, and broad Python version support make it straightforward to adopt. However, the aging maintenance status (last release over a year ago) and beta classification suggest evaluating whether the feature set meets your needs before committing to production use. No known vulnerabilities.
Install
captcha on PyPI
pip
pip install captchauv
uv add captchapoetry
poetry add captchaInstalling captcha
Before you install
Low friction install with a single runtime dependency (Pillow). The package is aging but actively maintained; the repository shows recent commits and no archived status, though the last release was over a year ago.
License in practice
Licensed under BSD-3-Clause, a permissive license that allows commercial and private use with minimal restrictions—suitable for most production deployments.
Quickstart
pip install captcha
from captcha.audio import AudioCaptcha
from captcha.image import ImageCaptcha
audio = AudioCaptcha(voicedir='/path/to/voices')
image = ImageCaptcha(fonts=['/path/A.ttf', '/path/B.ttf'])
data = audio.generate('1234')
audio.write('1234', 'out.wav')
data = image.generate('1234')
image.write('1234', 'out.png')
Requires Pillow as a runtime dependency; audio generation requires voice data files and image generation requires font files (built-in data available but custom data recommended).
Verify before relying
- Whether built-in voice and font data are sufficient for production use or if custom data is mandatory.
- Current performance characteristics and scalability limits for high-volume CAPTCHA generation.
- Whether the package supports modern CAPTCHA variants (e.g., reCAPTCHA integration) or only standalone generation.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — Pillow |
| Maintenance | aging — 531 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 392,931/month — #7,003 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: captcha-0.7.1-py3-none-any.whl
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
django-simple-captchaAdds CAPTCHA image challenges to Django forms…
permissive · top 15,000 on PyPI
anticaptchaofficialSolves CAPTCHAs and related challenges (image…
permissive · top 15,000 on PyPI
voxcpmVoxCPM2 is a tokenizer-free text-to-speech…
permissive · top 15,000 on PyPI
2captcha-pythonA Python client for the 2Captcha API that…
permissive · top 15,000 on PyPI
fish-audio-sdkOfficial Python client for the Fish Audio API,…
permissive · top 15,000 on PyPI
ddddocrRecognizes text and detects objects in captcha…
permissive · top 15,000 on PyPI
recognizerSolves reCAPTCHA challenges using AI-based…
permissive · top 15,000 on PyPI
elevenlabsOfficial Python SDK for ElevenLabs…
permissive · top 5,000 on PyPI
pyttsx3pyttsx3 converts text to speech offline using…
copyleft · top 5,000 on PyPI
ResemblyzerResemblyzer generates a 256-value embedding…
permissive · top 15,000 on PyPI