bitstring is a pure Python module that makes the creation, manipulation and analysis of binary data as simple and natural as possible.


  • Supports Python 2.6 and later (including Python 3). Version 1.0 also supported Python 2.4 and 2.5.
  • Rich API - chances are that whatever you want to do there’s a simple and elegant way of doing it.
  • Bit level slicing, joining, searching, replacing and more.
  • Create bitstrings from hex, octal, binary, files, formatted strings, bytes, integers and floats of different endiannesses.
  • Powerful binary packing and unpacking functions.
  • Read from and interpret bitstrings as streams of binary data.


To download the module, as well as for defect reports, enhancement requests and Subversion repository browsing go to the project’s home on Google Code:

You may also be able to use just easy_install bitstring.


Written by Scott Griffiths <>. If you have any questions, suggestions or criticisms (about this module!) then please email me. Also if you use bitstring in your own project then I’d be interested to hear how it’s being used.

Developed with the help of