9 releases (5 stable)

1.1.0 Feb 9, 2023
1.0.4 Jan 31, 2023
1.0.3 Jul 22, 2022
1.0.1 Mar 5, 2022
0.1.2 May 23, 2021

#79 in Algorithms

Download history 78/week @ 2023-02-09 40/week @ 2023-02-16 11/week @ 2023-02-23 15/week @ 2023-03-02 6/week @ 2023-03-09 23/week @ 2023-03-16 1/week @ 2023-03-23 3/week @ 2023-03-30 46/week @ 2023-04-06 11/week @ 2023-04-13 4/week @ 2023-04-20 2/week @ 2023-04-27 25/week @ 2023-05-04 15/week @ 2023-05-11 4/week @ 2023-05-18 14/week @ 2023-05-25

58 downloads per month

MIT license

6.5K SLoC


Crates.io Packaging status

Compare binary files using alignment algorithms.

Terminal screenshot of biodiff. One can see two files displayed in hex above each other with an ascii column. There are areas that are skipped in one file and displayed in green in the other one. Common bytes are displayed as white and differing ones (aside from missing ones) as red.

What is this

This is a tool for binary diffing.

The tool is able to show two binary files side by side so that similar places will be at the same position on both sides and bytes missing from one side are padded. It uses bio-informatics algorithms from the rust-bio library (typically used for DNA sequence alignment) for that. The dialog boxes for configuration are done using cursive.


  • Unaligned view for moving both sides independently as contiguous byte segments
  • Aligned view for comparing corresponding bytes of both files
  • Many configurable byte representations (bases 2, 8, 10, 16; mixed ascii/hex, braille, roman numerals)
  • Right-to-left mode, horizontal and vertical split, ascii and bar column
  • Configurable bytes per row, adjustable by pressing [, ], 0
  • Automatic determination of width by finding repetitions in visible/selected bytes by pressing '='
  • Search using text, regex and hexagex


Execute biodiff file_a file_b in a terminal and you should be dropped into a hex view showing two files side by side. Initially, the files will not be aligned and displayed without gaps on each side. By moving the cursor and views to a place where the left side and right side are similar and pressing F3 (or 3), they can be aligned. This is done block by block in standard configuration, which means that bytes near the cursor are aligned first and further aligned blocks are displayed later on both sides.

It is also possible to do global and local alignment (of the whole files at once) by changing the settings using F4 (be sure to consult the help on the parameters). Generally, since it takes quadratic time and space, the global/local alignment will not work well for files bigger than 64kB. There is also a "banded" algorithm which is faster, but slightly less accurate.

You can also select a region on one file and by pressing F3 the aligning algorithm will do a glocal alignment using the selected bytes as a pattern to find the corresponding bytes on the other file.


There should be downloadable binary files for some environments under the releases page. Alternatively, you can also install this using cargo by doing cargo install biodiff.

You can also execute directly using code from this repository by executing cargo run --release -- file_a file_b.

By default, settings are stored in a platform-specific user directory. To use a custom settings directory, set the BIODIFF_CONFIG_DIR environment variable to the desired directory path before running biodiff. If the directory doesn't exist, it will be automatically created.


This project is licensed under the MIT license.


~463K SLoC