You can use the xxd command to transform a file in Vim to hex representation, doing :%!xxd This requires the command line tool xxd to be installed, part of vim-common: CentOS 7: yum install vim-common Redhat: apt-get install vim-common