hexyl: A Color-Coded Hex Viewer for the Terminal
A command-line hex viewer
At a glance
- What is it?
- hexyl is a command-line hex viewer for Unix terminals that uses color to distinguish byte categories: NULL bytes, printable ASCII, whitespace, other ASCII, and non-ASCII bytes. It is a single binary written in Rust and installs from most major package managers.
- Who is it for?
- hexyl is a practical replacement for xxd or od when reading binary files in a terminal. The color-coded output makes it faster to visually locate NULL regions, ASCII strings, and non-ASCII data at a glance.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 153 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What hexyl Does and Who It Replaces
hexyl is a terminal hex viewer. Given a binary file, it prints three columns: a byte offset on the left, hex values in the middle, and an ASCII representation on the right, in the same format as traditional hex viewers like xxd or od. The difference is color. hexyl uses colored output to show five categories of bytes: NULL bytes, printable ASCII characters, ASCII whitespace characters, other ASCII characters below 0x80, and non-ASCII bytes above 0x7F.
This visual categorisation is the tool's central feature. When looking at a binary that mixes ASCII header text with binary data, the colors make the structure immediately visible without requiring the reader to interpret each hex value manually. hexyl is aimed at developers and system administrators who regularly inspect binary files, compiled output, or network packets in a terminal.
Installing hexyl Across Platforms
hexyl is packaged for a large number of systems. On Ubuntu 19.10 or newer and Debian Buster or newer:
sudo apt install hexylOn Fedora 35 or newer:
sudo dnf install hexylOn macOS via Homebrew:
brew install hexylVia Cargo with Rust 1.56 or newer:
cargo install hexylOr from the repository directly:
git clone https://github.com/sharkdp/hexyl
cargo install --path ./hexylAdditional package managers are supported: Arch Linux via pacman, Void Linux via xbps-install, Gentoo via the dm9pZCAq overlay, FreeBSD via pkg, NetBSD via pkgin, OpenBSD via pkg_add, Termux via pkg, Nix via nix-env, Guix via guix package, Scoop on Windows, and snap. The release page on GitHub also provides binary builds for systems without a package manager.
Configuring Colors via Environment Variables
hexyl's color scheme is set through six environment variables, one for each byte category:
- `HEXYL_COLOR_ASCII_PRINTABLE`: non-whitespace printable ASCII characters - `HEXYL_COLOR_ASCII_WHITESPACE`: space, newline, and similar whitespace bytes - `HEXYL_COLOR_ASCII_OTHER`: remaining ASCII characters below 0x80 - `HEXYL_COLOR_NULL`: the null byte (0x00) - `HEXYL_COLOR_NONASCII`: bytes above 0x7F - `HEXYL_COLOR_OFFSET`: the left-hand file offset column
Colors accept eight standard terminal color names: black, blue, cyan, green, magenta, red, yellow, and white. The bright variants are also supported, for example `bright blue`. RGB hex values in the format `#abcdef` are accepted as well. The README gives this example:
HEXYL_COLOR_ASCII_PRINTABLE=blue HEXYL_COLOR_ASCII_WHITESPACE="bright green" HEXYL_COLOR_ASCII_OTHER="#ff7f99"This environment-variable approach means the colors can be set per-session or per-script without modifying a configuration file.
What hexyl Cannot Do
hexyl is a viewer, not an editor. It has no mechanism for modifying bytes in a file. Engineers who need to patch a binary must use a different tool. The README and Cargo.toml description both describe it as a command-line hex viewer, with no editing functionality mentioned anywhere in the repository.
The project's dependency on terminal color support means it works best in environments that support ANSI escape sequences. On Windows, the README notes that ConHost v2 from Windows 10 version 1703 and Windows Terminal from Windows 10 version 1903 support the required escape sequences. Older Windows terminals display garbled color codes rather than colored output.
The Cargo.toml lists rust-version as 1.88, meaning the minimum supported Rust version for building from source is 1.88. The binary builds on the release page do not require any Rust installation. The examples/ directory in the repository contains a simple.rs example that demonstrates the library interface, suggesting hexyl can also be used as a Rust library, though the primary use case is the command-line binary.
hexyl Compared to xxd
xxd is the hex viewer bundled with Vim and available on virtually every Unix system. Both tools show offset, hex values, and ASCII representation. The functional difference is that xxd offers two-way conversion: it can convert a hex dump back to binary, which makes it useful for patching files. hexyl offers no such conversion.
xxd produces monochrome output by default. hexyl's color-coding is its sole differentiator. For users who are primarily reading binary files rather than modifying them, hexyl's colored output reduces the cognitive effort of parsing the output. For users who need xxd's round-trip capability, hexyl is not a complete replacement.
The Cargo.toml shows hexyl depends on owo-colors for the colored output, clap 4 for CLI argument parsing, and terminal_size for auto-detecting the terminal width. The library dependencies are minimal overall.
Build, Release History, and License
hexyl is written in Rust and builds with Cargo. The current version is 0.17.0, released on 2026-02-14. Version 0.16.0 shipped on 2024-12-27 and v0.15.0 on 2024-10-29. The last push to the repository was on 2026-04-30, approximately five months before the date of this writing.
The Cargo.toml specifies a release profile with link-time optimisation (`lto = true`) and single codegen unit (`codegen-units = 1`), which produces a smaller and faster binary at the cost of longer compile times. The binary builds on the release page are compiled with these settings.
A man page is included in the doc/ directory. Converting it from Markdown requires Pandoc: `pandoc -s -f markdown -t man -o ./doc/hexyl.1 ./doc/hexyl.1.md`. The CHANGELOG.md in the repository root documents changes across versions.
hexyl is dual-licensed under the Apache License 2.0 and the MIT license. Users can choose either license.
Editorial conclusion
hexyl is a practical replacement for xxd or od when reading binary files in a terminal. The color-coded output makes it faster to visually locate NULL regions, ASCII strings, and non-ASCII data at a glance. The last push to the repository was on 2026-04-30. Teams that need hex editing rather than viewing should look elsewhere; hexyl is explicitly a viewer. Colors can be customised via six environment variables for users whose terminal palette conflicts with the defaults, which is the main configuration surface the project exposes.
Frequently asked questions
How do I install hexyl on Linux?
On Ubuntu 19.10 or newer and on Debian Buster or newer, run `sudo apt install hexyl`. On Fedora 35 or newer, run `sudo dnf install hexyl`. On Arch Linux, use `pacman -S hexyl`. For other distributions, binary builds are available on the GitHub releases page.
Can hexyl edit binary files?
No. hexyl is a viewer only. It displays hex and ASCII representations of binary files with color-coded byte categories, but it has no functionality for modifying or writing files. Users who need to edit binary files should use a different tool.
How do I change hexyl's colors?
hexyl colors are set via environment variables: HEXYL_COLOR_NULL, HEXYL_COLOR_ASCII_PRINTABLE, HEXYL_COLOR_ASCII_WHITESPACE, HEXYL_COLOR_ASCII_OTHER, HEXYL_COLOR_NONASCII, and HEXYL_COLOR_OFFSET. Each accepts a standard terminal color name, a bright variant, or an RGB hex value like #abcdef.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/sharkdp-hexyl)