bitstring
Simple construction, analysis and modification of binary data.
Decision gist · record as of 2026-08-14
Yes. bitstring is production-stable, actively maintained, has no known vulnerabilities, and low install friction. It's the standard choice for bit-level binary manipulation in Python. Install it if you need to work with binary protocols, data formats, or bit-level operations; the API is well-documented and the library is widely trusted in the community.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a pure-Python wheel distribution.
- Actively maintained since 2006 with a recent release 157 days ago; the project has 446 repository stars and remains under active development.
License · maintenance · safety
MIT (permissive) — Released under the MIT license (permissive), which permits commercial and private use with minimal restrictions—suitable for most projects without licensing concerns.
last release 2026-03-10 (157 days) · last repo commit 2026-08-10 · 446 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 5,910,491 downloads/mo, #2,014 on PyPI
Alternatives
Verify before relying
pip install bitstring
from bitstring import BitArray, Bits, pack
a = BitArray(bin='00101')
b = Bits('0xff, 0b101, 0o65')
c = pack('intle16, hex=a', 100, a='0x34f')
print(a.hex, a.bin, a.uint)- Performance characteristics when handling very large binary datasets or streaming scenarios.
- Compatibility guarantees between bitstring and its new Rust-based sibling tibs package.
What it is and what it does
bitstring is a Python library for working with binary data at the bit level. It lets you create bitstrings from hex, octal, binary, bytes, integers, floats, and files, then manipulate them through slicing, searching, replacing, and packing operations. The library provides idiomatic Python classes (Bits, BitArray, BitStream) and utility functions, making bit-level work feel natural rather than low-level.
The package is production-stable and has been actively maintained since 2006. It depends on bitarray and tibs (a newer Rust-based rewrite of the core, currently in beta). The library supports Python 3.8 through 3.14 and is widely used—it ranks in the top 5000 PyPI packages by download volume. It's particularly useful for tasks like binary protocol parsing, data serialization, and bit manipulation in embedded or network contexts.
Use it for
- Parse binary network protocols or file formats by creating bitstrings from hex/binary and extracting fields via bit-level slicing.
- Pack and unpack structured binary data (e.g., multi-format fields) using the pack function with endianness control.
- Search for and replace bit patterns within binary data, useful for binary data transformation pipelines.
- Read and interpret binary streams sequentially, tracking position and reading typed chunks (uint, float, etc.).
- Create and manipulate arrays of fixed-length bitstrings for efficient storage of homogeneous binary records.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
bitstring is production-stable, actively maintained, has no known vulnerabilities, and low install friction. It's the standard choice for bit-level binary manipulation in Python. Install it if you need to work with binary protocols, data formats, or bit-level operations; the API is well-documented and the library is widely trusted in the community.
Install
bitstring on PyPI
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained since 2006 with a recent release 157 days ago; the project has 446 repository stars and remains under active development.
License in practice
Released under the MIT license (permissive), which permits commercial and private use with minimal restrictions—suitable for most projects without licensing concerns.
Quickstart
pip install bitstring
from bitstring import BitArray, Bits, pack
a = BitArray(bin='00101')
b = Bits('0xff, 0b101, 0o65')
c = pack('intle16, hex=a', 100, a='0x34f')
print(a.hex, a.bin, a.uint)
Verify before relying
- Performance characteristics when handling very large binary datasets or streaming scenarios.
- Compatibility guarantees between bitstring and its new Rust-based sibling tibs package.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesbitarraytibs |
| Maintenance | Actively maintained 157 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,910,491 / month, #2,014 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 :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming 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 :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: bitstring-4.4.0-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 › “binary data manipulation python”
- bitstringbitstring provides Python classes and functions to create,…
- PyByteBufferPyByteBuffer provides Java ByteBuffer-style buffer manipulation for…
- tibsTibs provides immutable and mutable bit-level data structures (Tibs…
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 bitmap · bitstruct · tibs · bitarray-hardbyte · bitarray · hachoir · cbitstruct · intelhex · PyByteBuffer · fixedint