What Are Binary Numbers?

Binary is a language computers understand

Binary Numbers

When you learn most types of computer programming, you touch upon the subject of binary numbers. The binary number system plays an important role in how information is stored on computers because computers only understand numbers—specifically base 2 numbers. The binary number system is a base 2 system that uses only the numerals 0 and 1 to represent off and on in a computer's electrical system. The two binary digits, 0 and 1, are used in combination to communicate text and computer processor instructions.

Although the concept of binary numbers is simple once it is explained, reading and writing them is not clear at first. To understand binary numbers—which use a base 2 system—first look at our familiar system of base 10 numbers.

Base 10 Number System: Math As We Know It 

Take the three-digit number 345 for example. The farthest right number, 5, represents the 1s column, and there are 5 ones. The next number from the right, the 4, represents the 10s column. We interpret the number 4 in the 10s column as 40. The third column, which contains the 3, represents the 100s column, and we know it to be three hundred. In base 10, we don't take ​the time to think through this logic on every number. We just know it from our education and years of exposure to numbers.

Base 2 Number System: Binary Numbers

Binary works in a similar way. Each column represents a value, and when you fill one column, you move to the next column.

In our base 10 system, each column needs to reach 10 before  moving to the next column. Any column can have a value of 0 through 9, but once the count goes beyond that, we add a column. In base two, each column can contain only 0 or 1 before moving to the next column.

In base 2, each column represents a value that is double the previous value.

The values of positions, starting on the right, are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 and so on.

The number one is represented as 1 in both base ten and binary, so let's move on to the number two. In base ten, it is represented with a 2. However, in binary, there can be only a 0 or a 1 before moving on to the next column. As a result, the number 2 is written as 10 in binary. It requires a 1 in the 2s column and 0 in the 1s column.

Take a look at the number three. Obviously, in base ten it is written as 3. In base two, it is written as 11, indicating a 1 in the 2s column and a 1 in the 1s column. 2+1 = 3.

Reading Binary Numbers

When you know how binary works, reading it is simply a matter of doing some simple math. For example:

1001 - Since we know the value' each of these slots represent, then we know this number represents 8 + 0 + 0 + 1. In base ten this would be the number 9.

11011 - You calculate what this is in base ten by adding the values of each position. In this case, they are 16 + 8 + 0 + 2 + 1. This is the number 27 in base 10.

Binaries at Work in a Computer

So, what does all this mean to the computer? The computer interprets combinations of binary numbers as text or instructions.

For example, each lowercase and uppercase letter of the alphabet is assigned a different binary code. Each is also assigned a decimal representation of that code, called an ASCII code. For example, the lowercase "a" is assigned the binary number 01100001. It is also represented by the ASCII code 097. If you do the math on the binary, you'll see it equals 97 in base 10.