How to Read Binary

Learning how to read binary helps with understanding computers

Image of computer memory and binary code

geralt/Pixabay

If you're interested in learning how to read binary, it's important to understand how binary numbers work.

Binary is known as a "base 2" numbering system, meaning there are two possible numbers for each digit; a one or a zero. Larger numbers are written by adding additional ones or zeros to the binary number.

Understanding Binary Numbers

Knowing how to read binary isn't critical for using computers. But it's good to understand the concept to gain a better appreciation for how computers store numbers in memory. It also allows you to understand terms like 16-bit, 32-bit, 64-bit, and memory measurements like bytes (8 bits).

How to Read Binary Code

"Reading" binary code typically means translating a binary number into a base 10 (decimal) number that people are familiar with. This conversion is simple enough to perform in your head once you understand how the binary language works.b

Each digit location in a binary number has a specific value if the digit isn't a zero. Once you've determined all of those values, you simply add them together to get the base 10 (decimal) value of the binary number.

To see how this works, take the binary number 11001010.

  1. The best way to read a binary number is to start with the right-most digit, and work your way left. The power of that first location is zero, meaning the value for that digit, if it's not a zero, is two to the power of zero, or one. In this case, since the digit is a zero, the value for this place would be zero.

    Image of a binary number conversion
  2. Next, move on to the next digit. If it's a one, then calculate two to the power of one. Make a note of this value as well. In this example, the value is two to the power of one, which is two.

    Image of calculating a binary number
  3. Continue to repeat this process until you get all the way to the leftmost digit.

    Image of calculating a binary number
  4. To finish, all you need to do is add all of those numbers together to get the overall decimal value of the binary number: 128 + 64 + 0 + 0 + 8 + 0 + 2 + 0 = 202

Another way to see this entire process in equation form is as follows: 1 x 27 + 1 x 26 + 0 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 = 202

Signed Binary Numbers

The method above works for basic, unsigned binary numbers. However, computers need a way to represent negative numbers using binary as well.

Because of this, computers use signed binary numbers. In this type of system, the leftmost digit is known as the sign bit, while the remaining digits are known as the magnitude bits.

Reading a signed binary number is almost the same as unsigned, with one minor difference.

  1. Perform the same procedure as described above for an unsigned binary number, but stop once you reach the leftmost bit.

    Screenshot of reading a signed binary number
  2. To determine the sign, examine the leftmost bit. If it's a one, then the number is negative. If it's a zero, then the number is positive.

    Image of calculating a signed binary number
  3. Now, perform the same calculation as before, but apply the appropriate sign to the number as indicated by the leftmost bit: 64 + 0 + 0 + 8 + 0 + 2 +  0 = -74

  4. The signed binary method allows for computers to represent numbers that are either positive or negative. However, it does consume an initial bit, meaning larger numbers require slightly more memory than unsigned binary numbers would.