chardet
Universal character encoding detector
Decision gist · record as of 2026-08-14
Yes. chardet 7 is a mature, actively maintained library with zero dependencies, a permissive license, and no known vulnerabilities. It solves a real problem (encoding detection) with high accuracy and speed. Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Very low friction: zero runtime dependencies, pure Python wheel, actively maintained with a release 8 days ago.
- Supports Python 3.10+ on CPython and PyPy.
License · maintenance · safety
0BSD (permissive) — 0BSD (permissive public domain equivalent) allows unrestricted use, modification, and distribution with no attribution requirement—a significant licensing improvement over the previous LGPL versions.
last release 2026-08-06 (8 days) · last repo commit 2026-08-13 · 2,659 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 199,045,239 downloads/mo, #208 on PyPI
Alternatives
Verify before relying
pip install chardet
import chardet
result = chardet.detect(b"Hello world")
print(result) # {'encoding': 'ascii', 'confidence': 1.0, 'language': 'en', 'mime_type': 'text/plain'}- Whether mypyc-compiled wheels are distributed by default or require separate installation.
- Performance characteristics on very large files (gigabytes) or streaming scenarios beyond the test set.
- Accuracy on mixed-encoding or corrupted data not represented in the 2,517-file benchmark.
What it is and what it does
chardet 7 is a ground-up rewrite of the character encoding detector, offering a drop-in replacement for older versions with the same public API. It analyzes byte sequences to identify their encoding (from a set of 99 supported encodings), assigns a confidence score, detects the likely language, and identifies MIME types for binary files. The package uses a 13-stage detection pipeline combining BOM detection, magic number identification, structural probing, byte validity filtering, and statistical bigram models.
The rewrite prioritizes speed and accuracy: it reports 99.3% accuracy on its 2,517-file test set, runs 134x faster than chardet 6.0.0, and achieves higher accuracy than charset-normalizer while being significantly faster. It supports streaming detection for large files, encoding-era filtering to reduce false positives, and per-call inclusion/exclusion of specific encodings. The package has zero runtime dependencies, works on both CPython and PyPy, and is licensed under 0BSD (permissive public domain).
Use it for
- Detect encoding of uploaded files in web applications before processing or displaying them.
- Identify character encoding in log files or network streams to ensure correct parsing and storage.
- Classify binary file types (images, audio, archives) by magic number signatures in data pipelines.
- Restrict encoding detection to modern web standards (UTF-8, Windows-1252) to reduce false positives.
- Detect language alongside encoding to route text to language-specific processing or display systems.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
chardet 7 is a mature, actively maintained library with zero dependencies, a permissive license, and no known vulnerabilities. It solves a real problem (encoding detection) with high accuracy and speed. Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.
Install
chardet on PyPI
Before you install
Very low friction: zero runtime dependencies, pure Python wheel, actively maintained with a release 8 days ago. Supports Python 3.10+ on CPython and PyPy.
Requires Python 3.10 or later.
License in practice
0BSD (permissive public domain equivalent) allows unrestricted use, modification, and distribution with no attribution requirement—a significant licensing improvement over the previous LGPL versions.
Quickstart
pip install chardet
import chardet
result = chardet.detect(b"Hello world")
print(result) # {'encoding': 'ascii', 'confidence': 1.0, 'language': 'en', 'mime_type': 'text/plain'}
Verify before relying
- Whether mypyc-compiled wheels are distributed by default or require separate installation.
- Performance characteristics on very large files (gigabytes) or streaming scenarios beyond the test set.
- Accuracy on mixed-encoding or corrupted data not represented in the 2,517-file benchmark.
Package 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 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 199,045,239 / month, #208 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Linguistic |
Evidence: chardet-7.5.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “language detection from bytes”
- chardetDetects character encoding and language in byte sequences with high…
- cigamDetects and reports file types, MIME types, and extensions by…
- pycld2Detects the language of text using Google's CLD2 library, supporting…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also cchardet · charset-normalizer · ftfy · encutils · webencodings · faust-cchardet · binaryornot · types-chardet · isbinary · mbstrdecoder