`xxd` is an external program that ships with Vim for converting text files and binary files.

  • :!xxd will convert the contents of the buffer into hex and allow you to edit in hex mode.
  • :!xxd -r will convert the contents of the buffer back into it's original format to be edited in normal mode.