Options  |  About
Working with the Binary Number System

We are all familiar with the decimal system. We utilize ten digits in different combinations to represent numbers. These numerals, of course, are 0,1,2,3,4,5,6,7,8 and 9. The computer, on the other hand, uses the binary system. This system is much simpler than our familiar decimal system. Instead of utilizing ten digits, it only uses 0 and 1.

The four basic arithmetic operations (addition, subtraction, multiplication and division) can be reduced to two - addition and subtraction. Multiplication is really repeated addition, while division is really repeated subtraction. This fact makes it possible to handle these operations in binary form.



The Binary Number System

In order to convert a decimal number into a binary number, we have to keep a few things in mind. For example, in the decimal system, the number 151 really means this:

Hundreds Tens Units
1 5 1

Thus, the number 150 can also be represented as (1* 102) + (5 * 101) + (1 * 100). The 1 is in the hundreds place. The five is in the tens place, and the zero is in the units place. Each position in the decimal system stands for a value multiplied by a different power of ten. This is why the decimal system is sometimes referred to as the base ten system. The numbers 102, 101 and 100 represent the place values of the digits- the numbers by which the digits are multiplied. Here is a table to show you what this means, using the number 150 as an example:

  Hundreds Tens Units
Digit 1 5 1
Meaning 1 * 102 5 * 101 1 * 100
Value 100 50 1

Similarly, the binary system can be represented in exactly the same way, except, the place values are the powers of two. Thus, the binary system is sometimes called the base two system. Since binary can only have the 1 and 0 digits, we will use the number 110101 as an example:

Digit 1 1 0 1 0 1
Meaning 1  * 25 1 * 24 0 * 23 1 * 22 0 * 21 1 * 20
Value 32 16 0 4 0 1


Bits and Bytes

Although a bit is the smallest form of data that a computer, there are names for larger amounts of bits. For example, 8 bits is considered to be 1 byte. With this information in mind, here is a table which shows you the different data size names used by the computer, and how many bits each is:

Name Abbrivation Number of Bytes (as a power) Number of Bytes
Byte - 20 1
KiloByte KB 210 1,024
MegaByte MB 220 1,048,576
GigaByte GB 230 1,073,741,824
TeraByte TB 240 1,099,511,627,776
PetaByte PB 250 1,125,899,906,842,624
ExaByte EB 260 1,152,921,504,606,846,976
ZettaByte ZB 270 1,180,591,620,717,411,303,424
YottaByte YB 280 1,208,925,819,614,629,174,706,176

As you can see, each step goes up by 210. Note, you only need to be acquainted with Byte up to GigaByte, because the other sizes are not used yet (computers have not advanced enough to be able to use them), although there are a few hard drives that have a storage of a TeraByte or more.



Converting Binary to Decimal

Converting a binary number into a decimal number is simple. To figure out what this number stands for, we have to add up numbers at each place value of the binary number. Let us use the binary number 1101110 as an example:

1 * 32 = 32
1 * 16 = 16
0 * 8 = 0
1 * 4 = 4
0 * 2 = 0
1 * 1 = 1
Total 53

Answer - 1101110 in binary is 53 in decimal.



Converting Decimal to Binary

Converting a decimal number into binary is also very simple. It involves a continuous division of the decimal number and keeping track of the remainder. Let us use the decimal number 220 as an example:

Division Remainder
220 / 2 = 110 0- Least Significant Bit (LSB)
110 / 2 = 55 0
55 / 2 = 27 1
27 / 2 = 13 1
13 / 2 = 6 1
6 / 2 = 3 0
3 / 2 = 1 1
1 / 2 = 0 1 - Most Significant Bit (MSB)

Answer - 220 in decimal is 11011100 in binary.

The Most Significant Bit is exactly what the name infers, the most significant. This means that it has the largest value out of all the bits. Since the MSB is the last on the table, we have to place the last bit from the table first, and work our way up. Therefore the decimal number 220 is 11011100 in decimal, not 00111011.



Binary Addition

Now that we know how to convert binary to decimal and vice versa, it is time to learn how to add two binary numbers together.  Binary addition is done the same way as decimal addition, which is using the carry method. Here is an example of using the carry method to add up two decimal numbers:

As you can see, when 8 and 6 were added, 4 was recorded as the units digit for the answer, and a 1 was carried over to the tens column. Here is an example of how binary numbers are added.

For the binary addition example, the binary numbers 1001 and 0101 will be added:

We first add the two least significant bits from the two numbers to be added, 1 and 1. Recall that binary can only have 0's and 1's. 1 + 1 would be recorded as 0 in the 20 column, and a 1 would have to be carried to the next 21 column. We then add 0 + 0 + the carry of 1, and get an answer of 1 in the 21 column. Next we add the 0 and the 1, and get an answer of 1 in the 22. Finally, we add up the 1 and 0 and get an answer of 1 in the 23. The final answer is then revealed to be 1110. As you can see, binary addition is very easy for people who know how to add larger decimal numbers together.



Binary Subtraction

There are a few ways to subtract binary numbers, but to avoid any confusion, we will use the borrow method already familiar to you. Lets recall decimal subtraction with an example:

When we subtract the numbers in the units column, as well as the tens column, there is no problem. When we get to the 100's column, notice how the number on the top is smaller than the number on the bottom. To continue with the subtraction, we borrow from the 1000's column, and place it in the 100's column. Now, we get 12 - 4 which is 8. Finally, the 3 is changed to the two in the 1000's column because of the borrow, and 2-1 = 1, leaving us with the final answer of 1822.

As an example of binary subtraction, we will subtract 0101 from 1011

In the 20 and 21 column, subtraction occurs the same way as it would in decimal subtraction. When we get to the 23 column, we have to borrow. The 0 in the 23 column is changed to two 1's because you need to borrow form 24 column, which is worth twice as much as the 23 column. Because you borrowed a 1 from the 24 column you change it to a 0. The rest of the subtraction is simple, and done the same way it would be done in normal decimal subtraction.

Back Forward
Back Forward

Gates of Creation // Basic Hardware // Number System