Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a neat way to see the difference between two binary files? They are mostly the same, but some bytes are changed, and one of the files has sequences inserted in some places.

Diffing the output of xxd would work if bytes were only changed, and not inserted.

share|improve this question
i would graphically diff the hexdumps of both binaries with vimdiff – user1146332 Dec 30 '12 at 13:43

There are a few binary editors that can show differences between files, but the ones I've tried (dhex and vbindiff) don't seem to be able to detect and show insertions or deletions.

There are a number of binary diff utilities like rdiff, xdelta or bsdiff that compute the difference between two files. But the purpose is to generate patch files to be later applied to an original. You can't read those patch files to see what the differences are.

Something you can do, to visually see the difference, is to hexdump the files with one byte per line and diff the results. The line numbers will tell you the offset in the file (though beware it starts at 1, not 0):

diff -u <(od -w1 -vAn -tx1 file1) <(od -w1 -vAn -tx1 file2)

(assuming your od supports the non-standard -w option).

share|improve this answer

try using dhex or jojodiff . You can also use bsdiff.

share|improve this answer
bsdiff looks like xdelta, wonder wich generates the smaller binary patch tho.. – Aquarius Power May 24 at 3:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.