bitstring is a Python library to help make the creation and analysis of all types of bit-level binary data as simple and efficient as possible. It has been actively maintained since 2006.
[!NOTE]
To see what been added, improved or fixed, and also to see what’s coming in the next version, see the release notes.
News
I’m rewriting the core of bitstring in Rust, and have released that cut-down and streamlined interface as the tibs package. It’s now in beta, and feedback is welcome. Just pip install tibs to try it out.
A sleek Python library for your binary data
Overview
Efficiently store and manipulate binary data in idiomatic Python.
Create bitstrings from hex, octal, binary, files, formatted strings, bytes, integers and floats of different endiannesses.
Powerful binary packing and unpacking functions.
Bit-level slicing, joining, searching, replacing and more.
Create and manipulate arrays of fixed-length bitstrings.
Read from and interpret bitstrings as streams of binary data.
Rich API - chances are that whatever you want to do there’s a simple and elegant way of doing it.
Open source software, released under the MIT licence.
Documentation
Extensive documentation for the bitstring library is available.
Some starting points are given below:
bitstring is a Python library to help make the creation and analysis of all types of bit-level binary data as simple and efficient as possible. It has been actively maintained since 2006.
News
I’m rewriting the core of bitstring in Rust, and have released that cut-down and streamlined interface as the tibs package. It’s now in beta, and feedback is welcome. Just
pip install tibsto try it out.A sleek Python library for your binary data
Overview
Documentation
Extensive documentation for the bitstring library is available. Some starting points are given below:
There is also an introductory walkthrough notebook on binder.
Examples
Installation
Creation
Different interpretations, slicing and concatenation
Reading data sequentially
Searching, inserting and deleting
Arrays of fixed-length formats
Copyright (c) 2006 - 2026 Scott Griffiths