hachoir
Package of Hachoir parsers used to open binary files
What it is and what it does
Hachoir is a Python library for parsing and inspecting binary files at the field level. It represents any binary stream as a tree where each node is a typed field—integers, strings, bits, padding, floats, and more—allowing you to navigate and understand the structure of binary data the way you would browse a filesystem. The library includes command-line tools for common tasks: hachoir-grep searches for text patterns in binary files, hachoir-metadata extracts metadata, hachoir-strip removes metadata, and hachoir-urwid provides a text-mode viewer for interactive browsing.
The package has no external runtime dependencies, making installation simple. It is actively maintained and marked as Production/Stable. However, it is licensed under GNU GPL v2 (copyleft), which means any code that uses or modifies it must also be released under GPL v2—a significant constraint for proprietary projects.
Use it for:
- Extract metadata from image, audio, or video files without relying on format-specific libraries.
- Reverse-engineer or analyze binary file formats by visually inspecting their structure field by field.
- Search for text patterns or signatures within binary files using hachoir-grep.
- Strip or modify metadata from binary files to remove sensitive information before sharing.
- Develop custom binary parsers by extending Hachoir's field types and parser framework.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Hachoir parses and displays binary files as a tree of typed fields, letting you inspect and edit individual bits, bytes, and structures within any binary stream.
Yes, if you need to inspect or parse binary files and accept the GPL v2 copyleft license. Hachoir is stable, actively maintained, has no external dependencies, and provides both a library API and useful command-line tools. It is not suitable for proprietary projects due to its copyleft license. For one-off binary inspection tasks or open-source work, it is a solid choice.
Install
hachoir on PyPI
pip
pip install hachoiruv
uv add hachoirpoetry
poetry add hachoirInstalling hachoir
Before you install
Installation is straightforward with no runtime dependencies. The package is actively maintained as of 2026-03-06 and marked Production/Stable, though the last release was in 2023.
License in practice
Hachoir is licensed under GNU GPL v2 (copyleft). Any derivative work or modification must also be released under GPL v2; proprietary or closed-source projects cannot use it without separate licensing.
Quickstart
pip install hachoir
from hachoir.parser import createParser
from hachoir.stream import FileInputStream
parser = createParser("example.bin")
if parser:
for field in parser:
print(field.name, field.value)
Requires Python 3.6 or newer. The hachoir-urwid command-line tool requires curses support (typically available on Unix-like systems).
Verify before relying
- Whether the package's binary parsing covers modern file formats or is limited to legacy formats.
- Performance characteristics when parsing very large binary files.
- Whether the editing capabilities support all field types or only a subset.
Package facts
| License | GNU GPL v2 (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 976 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 430,992/month — #6,723 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hachoir-3.3.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
tibsTibs provides immutable and mutable bit-level…
permissive · top 5,000 on PyPI
bitstringbitstring provides Python classes and functions…
permissive · top 5,000 on PyPI
pycnitePycnite provides pure Python parsers for Python…
permissive · top 5,000 on PyPI
pyxbeParse, inspect, and manipulate XBE executable…
permissive · top 15,000 on PyPI
binapyBinaPy wraps Python's binary-handling libraries…
permissive · top 5,000 on PyPI
graycodeConverts between two's complement integers and…
permissive · top 15,000 on PyPI
polyfile-weaveIdentifies and maps the semantic and syntactic…
permissive · top 5,000 on PyPI
streamlit-pdfAdds a PDF viewer component to Streamlit apps…
permissive · top 15,000 on PyPI
dissect.cstructParse binary data using C-like structure…
permissive · top 15,000 on PyPI
dissect.hypervisorParses hypervisor disk, backup, and…
agpl · top 15,000 on PyPI