hexrec
Library to handle hexadecimal record files
What it is and what it does
Hexrec is a library for working with hexadecimal record files—the text-based formats (Intel HEX and Motorola S-record) used in embedded systems to exchange binary data destined for microcontroller flash, EEPROM, or other non-volatile memory. It provides high-level functions to load, parse, edit, and save these files, as well as convert between formats, merge multiple files, and manipulate sparse binary data through a bytearray-like interface backed by bytesparse.
The library addresses a real pain point in embedded development: toolchain support for hex formats is often incomplete or buggy, and manual editing of record files is tedious because checksums and record boundaries must be recalculated. Hexrec handles that bookkeeping automatically. It can also be run as a command-line tool for common operations like format conversion, merging, and cropping.
Use it for:
- Convert a bootloader and application executable from HEX to SREC format for a board factory that accepts only one format.
- Merge multiple hex files (bootloader, app, config data) into a single file for microcontroller programming.
- Extract and modify a specific address range in a hex file (e.g., trim an app to fit a bootloader-reserved region).
- Generate test datasets by programmatically creating hex records with structured binary data at specific memory addresses.
- Compute and inject a CRC into a hex file at a predetermined address without re-compiling the firmware.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Loads, edits, and saves hexadecimal record files (Intel HEX and Motorola S-record formats) commonly used in embedded systems to represent binary data for non-volatile memory.
Yes. The package solves a genuine embedded-systems problem with low install friction, permissive licensing, and no known vulnerabilities. The aging maintenance status (385 days since release) is a minor concern but not a blocker, given that the repository is not archived and the last commit is recent. Install if you regularly work with hex or SREC files.
Install
hexrec on PyPI
pip
pip install hexrecuv
uv add hexrecpoetry
poetry add hexrecInstalling hexrec
Before you install
Low install friction with a pure-Python wheel and only three runtime dependencies. The package is aging (385 days since last release) but the repository remains active with a recent commit on 2025-07-25, suggesting maintenance rather than abandonment.
License in practice
BSD-2-Clause is permissive and poses no significant restriction on use, modification, or distribution in most commercial or open-source contexts.
Quickstart
pip install hexrec
from hexrec import convert
convert('data.hex', 'data.srec')
# Or merge multiple files:
from hexrec import merge
merge(['bootloader.hex', 'app.mot', 'config.xtek'], 'merged.srec')
Requires Python 3.9 or later.
Verify before relying
- Whether the package's sparse memory editing via bytesparse is performant for large binary files
- Completeness of support for all Intel HEX and Motorola S-record variants in the wild
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — bytesparse, click, colorama |
| Maintenance | aging — 385 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 223,231/month — #9,249 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hexrec-0.5.1-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
bincopyConverts between binary file formats (Motorola…
permissive · top 15,000 on PyPI
intelhexRead, write, and manipulate Intel HEX files, a…
permissive · top 5,000 on PyPI
crccheckCalculates CRC and checksum values from binary…
permissive · top 5,000 on PyPI
hexdumpConverts binary data to hexadecimal text…
permissive · top 15,000 on PyPI
libscrclibscrc provides a compiled library for…
copyleft · top 15,000 on PyPI
bytesparseProvides a bytearray-like class that stores…
permissive · top 15,000 on PyPI
crcCalculate, verify, and manage CRC checksums…
permissive · top 5,000 on PyPI
anycrcCalculates CRC hashes of arbitrary bit widths…
permissive · top 15,000 on PyPI
fastcrcfastcrc computes CRC checksums (8, 16, 32, and…
permissive · top 5,000 on PyPI
crcmodComputes Cyclic Redundancy Check (CRC) values…
permissive · top 5,000 on PyPI