Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I open up a binary file in Vim, it displays a bunch of gibberish. One would expect it to display a bunch of 1s and 0s. Why is this?

share|improve this question
One does not simply Vim into Binary. –  Snesticle Nov 7 '12 at 22:27
If you are using UNIX you can use the hd or hexdump command to dump out the the file in HEX and printable characters. –  HeatfanJohn Nov 7 '12 at 22:29

1 Answer 1

up vote 4 down vote accepted

Excellent question.

Text editors don't open files and show binary. They typically read files with ASCII or Unicode encoding.

Here's some examples of how ASCII encoding works:


Basically the way it works is, it reads the first number of bytes, and then interprets that collection of bits as a certain character, which is what you're seeing on your screen.

However, if you want to show binary (or hex) in Vim, you can, by doing something like this:


share|improve this answer
That makes a lot of sense. Thanks! –  David Sawyer Nov 8 '12 at 5: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.