chardet
Universal character encoding detector
Install
chardet on PyPI
pip
pip install chardetuv
uv add chardetpoetry
poetry add chardetPackage facts
| License | 0BSD (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: chardet-7.5.1-py3-none-any.whl
Keywords: chardet, charset, detection, encoding, unicode
About chardet
from the package's own PyPI description — quoted content, verbatim
chardet
Universal character encoding detector.
License: 0BSD (image) Documentation (image) codecov (image)
chardet 7 is a ground-up, 0BSD-licensed rewrite of chardet. Same package name, same public API — drop-in replacement for chardet 5.x/6.x, just much faster and more accurate. Python 3.10+, zero runtime dependencies, works on PyPy.
Read more details about the rewrite process.
Why chardet 7?
99.3% accuracy on 2,517 test files. 134x faster than chardet 6.0.0, and +13.9pp more accurate than charset-normalizer 3.4.9 at 2.6x its speed. Language detection for every result. MIME type detection for binary files. 0BSD licensed.
| | chardet 7.5.0 (mypyc) | chardet 6.0.0 | [charset-normalizer] 3.4.9 | | ---------------------- |...
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Detects character encoding and language in byte strings with 99.3% accuracy, supporting 99 encodings and 49 languages, plus MIME type identification for binary files.
Installs with zero runtime dependencies and low friction. Actively maintained with a release 7 days ago; Python 3.10+ support across CPython and PyPy.
Released under 0BSD (permissive), a public-domain-equivalent license with no attribution or derivative-work restrictions—a significant change from the LGPL of earlier versions.
Usage
pip install chardet
import chardet
result = chardet.detect(b"Hello, world!")
print(result) # {'encoding': 'ascii', 'confidence': 1.0, 'language': 'en', 'mime_type': 'text/plain'}
Requires Python 3.10 or later.
Verdict: A ground-up rewrite offering 134× speed and 11pp accuracy gain over chardet 6, with zero dependencies, active maintenance, and permissive 0BSD licensing. No known vulnerabilities. Suitable for production use where encoding detection is a core need.
Needs verification
- Whether the mypyc-compiled wheels are included in standard pip installs or require explicit opt-in.
- Performance characteristics on free-threaded Python (3.13+) relative to the claimed thread-safety improvements.
- Real-world accuracy on mixed-encoding or corrupted byte streams beyond the 2,517-file test set.
Similar packages
permissive · top 100 on PyPI
webencodingspermissive · top 1,000 on PyPI
requests-filepermissive · top 1,000 on PyPI
binaryornotpermissive · top 1,000 on PyPI
python-magicpermissive · top 1,000 on PyPI
pandocfilterspermissive · top 1,000 on PyPI
filetypepermissive · top 1,000 on PyPI
youtube-transcript-apipermissive · top 1,000 on PyPI
bleachpermissive · top 1,000 on PyPI
MarkupSafepermissive · top 100 on PyPI