skillfed

hachoir

Package of Hachoir parsers used to open binary files

hachoir v3.3.0 431.0K downloads/30d#6,723 on PyPI667
Copyleft license GNU GPL v2 Active released

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 hachoir

uv

uv add hachoir

poetry

poetry add hachoir

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Console :: CursesEnvironment :: PluginsIntended Audience :: DevelopersIntended Audience :: EducationLicense :: OSI Approved :: GNU General Public License (GPL)Natural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: MultimediaTopic :: Scientific/Engineering :: Information AnalysisTopic :: Software Development :: DisassemblersTopic :: Software Development :: InterpretersTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: FilesystemsTopic :: Text ProcessingTopic :: Utilities

Tags

binary file parserhex viewer field-basedbinary stream inspectionmetadata extraction binarybinary file editorbit-level file analysisbinary format dissection
binary-analysismetadata-extractionfile-format-parsing

More Python Modules packages