How to read binary numbers

Matthew Leng
3 min readApr 27, 2021

--

Photo by Alexander Sinn on Unsplash

After an interesting discussion with friends, I understand binary numbers a bit better and I want to share this knowledge with you! This was something that never came across my mind until I happened upon a Leetcode question of turning a string to lower case. Of course, it would be easy if we could use the methods given to us, but I opted to solve it without using any methods and found out adding 32 to the ASCII (American Standard Code for Information Interchange) value of the letter would give me a lower case value and you can subtract 32 to get the uppercase. This is where my friend had asked me, “Do you know why that is?”

ASCII (American Standard Code for Information Interchange) was created to be a standard data-transmission code that is used by smaller and less-powerful computers to represent letters, numbers, and symbols in 1 byte. Most modern character-encoding schemes are based on ASCII, but there may be support for additional characters.

What is a binary number?

From my understanding, binary is a base 2 system, this means each digit is a power of 2. Comparatively, what we understand numbers to be, is base 10, ie: 10, 100, 1,000, 10,000, etc. This is why we (at least for me!) think of the famous matrix aesthetic of green 0’s & 1’s flying down a black backdrop!

Each digit is referred to as a bit or binary digit. A single bit is either a 1 or 0 and that makes up the 8-bit binary number. With the binary number, we can translate it to ASCII code and know the value!

We can translate binary code that is 00000000 to 11111111 or in ASCII code 0–255.

Reading the binary number

In order to read the binary number, we have to translate each value into a base 10 number system that we are all familiar with.

Each digit location in a binary number has a specific value if it is represented with a 1. If it is represented with a 0, then there is no value there to be represented.

Let us look at this graphic I created here, as I am a visual learner:

11111111

Reading binary, we look from right to left as it goes from 0–7 in this order. Since each value in this binary number is represented with 1’s that means each value needs to be calculated.

2 to the power of 0 = 1

2 to the power of 1 = 2

2 to the power of 2 = 4

2 to the power of 3 = 8

2 to the power of 4 = 16

2 to the power of 5 = 32

2 to the power of 6 = 64

2 to the power of 7 = 128

Once we have that calcluated, we add each value up, 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Let us check out what the value of 255 is on a ASCII chart:

(https://theasciicode.com.ar/)

The value of 255 turns out to be a non-breaking space!

Try it yourself!

It is only fitting for me as a teacher to give you, the reader, something to try, right?!

I will leave you off with this little translating problem:

Given this binary number, what is the message?

01001000 01100101 01101100 01101100 01101111 00100001

Thank you for reading! I hope I helped you understand binary numbers a bit byte-ter! This is the most simple way of understanding it from my perspective.

Feel free to reach out if you have any questions!

LinkedIn

Twitter

--

--