Understanding Binary (2024)

An Introduction to the 0s and 1s

Understanding Binary (3)

Why you should read this article

Even before I learned how to code, I knew there was something called binary and that it was the language computers spoke. I assumed that at some point during my 15 week bootcamp, we would discuss the elusive 0s and 1s but I was wrong. As it turns out, the code I was writing in JavaScript was being compiled and translated into 0s and 1s as instructions for the computer to understand. You may be thinking “ok, so I do not need to know about binary or number systems to code, then why should I bother learning it at all?” Even though understanding number systems is not required to code, it remains essential to our understanding of Computer Science. If you have any interest in taking a deep dive into how computers work, your starting point should be number systems and specifically, binary.

The numbers we know, aka decimal

Understanding Binary (4)

Numbers are presented to us in something called place-value notation. This means that both the digit and its position(or place-value) must be known to determine its value.

Let’s look at this in the context of our number system. 5 by itself would be considered in the first position in our number system and therefore to determine its value we multiply it by 1 and get 5. What if the 5 is in the second position? The second positions in our number system multiplies the digit by 10, making its value 50. What if the 5 is in the third position? The third position multiplies the digit by 100, making its value 500.

I am sure most of you are saying “duh” right now. But breaking numbers down like this will help us understand other number systems we encounter. Another way of looking at the above is that each place value is determined by raising 10 to an ever increasing value (multiplying 10 by itself a certain number of times) and multiplying the result by the digit. For these reason, our number system is called base 10 or decimal. In the above examples:

5 in the first position = 5 *10⁰ = 5 * 1 = 5
5 in the second position = 5 * 10¹ = 5 * 10 = 50
5 in the third position = 5 * 10² = 5 * 100 = 500

The number 10 not only determines the order of magnitude for each place-value but also represents the number of possible values for each digit, which is 0–9. The above example only uses a single digit in different positions but what if we have multiple digits in different positions.

2 in the first position = 2*1⁰ = 2* 1 = 2
5 in the second position = 5 * 1¹ = 5 * 10 = 50
6 in the third position = 6* 1² = 6* 100 = 600
600 + 50 + 2 = 652

One thing to note is 0 which represents a position with no value, regardless of the position it is in. 0 times 10¹⁰ (10,000,000,000) is still 0. For this reason, the lowest digit that carries value is 1, not zero.

With only 10 possible digits in each position, what happens when the highest possible digit (9) increases by 1? We add the lowest digit that carries value to the next position and reset the current position to 0 or no value. In other words, 9 becomes 10.

The numbers computers know, aka binary

Understanding Binary (5)

Now that we have had a grade school math refresher and introduced some new glossary terms, we will break down binary in the same way we did our numeral system of base 10.

To begin, ask yourself what you know about binary. Odds are your answer will be that each position can only be a 0 or 1. Given what we discussed above, what base would binary be? The answer is 2. Base 2 not only means that each position can only have one of two possible digits but also that the order of magnitude of each place-value increases by powers of 2 instead of 10, as is the case with our number system.

Let us use the model from our base 10 examples to break down binary, using the number 1

1 at the first position (1) = 1 * 2⁰ = 1 * 1 = 1
1 at the second position (10) = 1 * 2¹ = 1 * 2 = 2
1 at the third position (100) =1 * 2² = 1 * 4 = 4
1 at the fourth position (1000) =1 * 2³ = 1 * 8 = 8
1 at the fifth position (10000) =1 * 2⁴ = 1 * 16 = 16

The above demonstrates how we can convert binary numbers to decimal based on 1 being at different positions and having different place-values. If the binary number is 11111, we can add all the above values up to get the total value in decimal

11111 = 1 + 10 + 100 + 1000 + 10000 = 1 + 2 + 4 + 8 + 16 = 31

Another way of looking at this is

11111 is 100000 minus 1 or
(1 * 2⁵) - 1 = 32 - 1 = 31

To make sense of this, we need to do some basic counting in binary. 0 and 1 are the only two possible numbers in each position with 1 being the number with the highest value. Starting with 0, if we add 1, we get 1 (same thing we see in decimal if we were to add 1 to 0). What happens if we add 1 to 1? Just as is the case with 9 in decimal, when we add 1 to 1 in binary, we add the lowest digit of value to the next position and reset the current position.

1 + 1 = 10

Following this pattern of increasing by 1

0
1
10
11
100
101
110
111
1000

Converting 0–100 in binary to decimal:

0= 0 * 2⁰ = 0 * 1 = 0
1= 1* 2⁰ = 1 * 1 = 1
10=(1*2¹) + (0 * 2⁰) = (1 * 2) + (0 * 1) = 2 + 0 = 2
11=(1* 2¹) + (1* 2⁰) = (1 * 2) + (1 * 1) = 2 + 1 = 3
100=(1*2²) + (0 * 2¹) + (0 * 2⁰)= (1 * 4) + (0 * 2) + (0 * 1) = 4 + 0 + 0 =4

This helps us understand binary as a number system but their true value in computers is more than simply representing decimal numbers in a different way.

Understanding Binary (6)

Turning binary in building blocks

How does a series of 0s and 1s become every computer application that has ever existed? Just as letters can be grouped to form words, words to form sentences, and sentences to form paragraphs. Binary can be grouped to represent everything from a simple decimal number (as we saw above) to complicated and elaborate instructions dictating the behavior of a character in a computer game.

Above, 0s and 1s were referred to as digits in the context of comparing binary to our number system. However, in the context of the code where binary is the foundation of every computer operation, 0s and 1s are bits. That is to say a 0 by itself is a bit and a 1 by itself is also a bit. When eight bits are grouped together, they form a byte. Finally a familiar term!

Besides numbers, one of the simplest uses of a byte is to represent a letter. This is done with the American Standard Code for Information Interchange, or ASCII, which “is a character encoding standard for electronic communication. ASCII codes represent text in computers”.

ABC: 01000001 01000010 01000011
Hello, world!: 01001000 01100101 01101100 01101100 01101111 00101100 00100000 01110111 01101111 01110010 01101100 01100100 00100001

(Make your own secret messages in binary here)

If one byte can only hold a single letter, you can imagine how many are needed for a song, movie, or game.

This is obviously and extensive topic but as the subtitle of this article says, this is meant to be an “Introduction to the 0s and 1s”, not a definitive guide. I hope this article can serve as a starting point for your own exploration into binary and other Computer Science concepts.

Understanding Binary (2024)

FAQs

How to easily understand binary? ›

To understand a number in binary, for whole numbers we need to recognise that the most significant binary digit (or bit for short) is on the left and least significant bit is on the right. As we look right to left, each bit represents a higher power of 2 (because binary is base 2).

What does 11111111 mean in binary? ›

Therefore, 255 in binary is 11111111.

How to answer binary questions? ›

A Binary Question is answered by picking one of two choices that are usually opposites. Examples include Yes / No or True / False questions.

What are the 4 rules of binary? ›

There are four rules of binary addition which are:
  • 0+0=0.
  • 0+1=1.
  • 1+0=1.
  • 1+1=10.
Jul 23, 2021

Can anyone understand binary? ›

Yes, totally. Some of us read binary. It is not every day, but especially if you are working in computer security and you are/were a reverse engineering guy for some time of your life, you need to read data and decrypt data.

What is Hello in binary? ›

What is hello in binary? Therefore, HELLO in binary is written as 01001000 01000101 01001100 01001100 01001111.

How to count in binary for dummies? ›

In binary notation, in the first column on the right (the "one" column), 0 means zero 1's, and 1 means one 1. In the next column to the left (the "two" column), 0 means zero 2's and 1 means one 2. In the next column (the "four" column), 0 means zero 4's, and 1 means one 4. The same pattern follows in each column.

Why is 11 in binary 3? ›

3 in binary is 11. Unlike the decimal number system where we use the digits 0 to 9 to represent a number, in a binary system, we use only 2 digits that are 0 and 1 (bits). We have used 2 bits to represent 3 in binary.

Is binary math hard? ›

Working with binary numbers doesn't have to be hard, even though most people are convinced that it is. Here's a understandable guide for everyone!

What is the easiest way to calculate binary? ›

To convert a decimal number to binary, you need to follow these steps:
  1. Divide the decimal number by 2 and write down the integer result (ignore the remainder).
  2. Repeat step 1 with the integer result until you get 0.
  3. Write down the remainders (in reverse order) of each division as 0 or 1 to get the binary equivalent.
May 21, 2020

Is yes or no binary? ›

Binary is a system where there only are two possible states. Yes or no, on or off. Computers contain trillions of these binary switches and they all indicate states of on or off.

How do I add 1 to a binary number? ›

Binary addition only has three rules:
  1. 0 + 0 = 0.
  2. 0 + 1 = 1 or 1 + 0 = 1.
  3. 1 + 1 = 10.

How do you solve for binary? ›

The step by step process to convert from the decimal to the binary system is:
  1. Find the largest power of 2 that lies within the given number.
  2. Subtract that value from the given number.
  3. Find the largest power of 2 within the remainder found in step 2.
  4. Repeat until there is no remainder.

Can binary go negative? ›

Negative Numbers

The simplest is to simply use the leftmost digit of the number as a special value to represent the sign of the number: 0 = positive, 1 = negative. For example, a value of positive 12 (decimal) would be written as 01100 in binary, but negative 12 (decimal) would be written as 11100.

What is the easiest way to get binary? ›

  1. Divide the number by 2.
  2. Record the result and the remainder.
  3. Continue to divide the result by 2.
  4. Stop until the result is 0.
  5. The binary answer is the remainder,read it from bottom.

How can I memorize binary numbers easily? ›

In this system, mnemonic images are created from the shapes of the binary numbers:
  1. 000 = the Three Stooges.
  2. 001 = glasses staring at a wall.
  3. 011 = bowling ball, 2-pin split.
  4. 111 = three fence posts.
  5. 110 = a bull's two horns goring a matador's face.
  6. 100 = putter, golf ball, cup.
  7. 010 = a canon with a wheel on each side.

How do you explain binary to a child? ›

The binary number system is a base-2 number system. This means it only has two numbers: 0 and 1. The number system that we normally use is the decimal number system. It has 10 numbers: 0-9.

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Corie Satterfield

Last Updated:

Views: 6200

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Corie Satterfield

Birthday: 1992-08-19

Address: 850 Benjamin Bridge, Dickinsonchester, CO 68572-0542

Phone: +26813599986666

Job: Sales Manager

Hobby: Table tennis, Soapmaking, Flower arranging, amateur radio, Rock climbing, scrapbook, Horseback riding

Introduction: My name is Corie Satterfield, I am a fancy, perfect, spotless, quaint, fantastic, funny, lucky person who loves writing and wants to share my knowledge and understanding with you.