# Binary Calculator

The following calculators can be used to add, subtract, multiply, or divide two binary numbers. You can also convert binary values into decimal values and vice versa.

To use Binary Calculator, enter the values in the input boxes below and click on Calculate button.

Binary system is a numerical system which functions almost exactly like the decimal system, which most people are more familiar with. The base number for the decimal system is 10, while the binary system uses 10. The binary system uses 2, whereas the decimal system uses 10, while the binary system uses 1, and each digit can be called a bit. These differences aside, operations like addition, subtraction and multiplication are all calculated using the same rules as in the decimal system.

Because of its simplicity in implementation in digital circuitry with logic gates, almost all modern technology and computers uses the binary system. It is easier to design hardware that can detect only two states (on and off, true/false or present/absent), than it is to detect more states. Hardware that can detect 10 states using a decimal system will be required, and this is more difficult.

Here are some examples of conversions between decimal and binary values: ## Binary/Decimal Converter

 Decimal Binary 0 0 1 1 2 10 3 11 4 100 7 111 8 1000 10 1010 16 10000 20 10100

Although working with binary can seem complicated at first, it is easy to understand that each binary value represents 2 n and each decimal place represents 10, , and 10 respectively. Let's take the number 8. The decimal number system places 8 in the first decimal position left of the decimal point. This signifies the 10 0 place. This basically means:

8 x 10 =8 x 1 =8

For comparison, use the number 18

(1 x 10 + (8 x10 ) = 10 + 8. = 18

Binary numbers 8 and 1000 are represented by the number 1. From left to right, the first zero represents 2 0, then the second 2 1 and finally the fourth 2 3. This is just like the decimal system but with a base of 2. A 1 is placed in the position that yields 1000, since 2 3 = 8. Take 18 or 10010.

18 = 16 + 2=24 + 2110010 = (1) x 24), + (0x23) + (0x22) + (1x21) + (0x20) = 18

This is the step-by-step process for converting from decimal to binary.

1. Find the greatest power of 2 within the given number
2. Add that value to the number given.
3. Find step 2's largest power of 2 in the remainder.
4. Continue doing this until you are done.
5. For each binary value found, enter a 1, and a 0, respectively.

Below is an alternative way to see the 18 target as an example.

 2n 24 23 22 21 20 For instances within 18 1 0 0 1 0 Target: 18 18 - 16 = 2 - 2 - 2 = 0

It is easier to convert from the binary system to the decimal one. Find the sum of all the place values that contain 1 and determine the order of these values.

EX: 10111 = (1x24) + (0x23) + (1x22) + (1x21) + (1x20) = 23

 24 23 22 21 20 1 0 1 1 1 16 0 4 2 1

Hence: 16 + 4 + 2 + 1 = 23.

Binary addition is the same as addition in decimal systems except that instead of carrying a 1 over when values are added equal 10, it is carried over when the result from addition equals 2. For more information, see the following example.

Notice that the binary system is:

• 0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0, Carry over the 1, i.e. 10

EX:

 10 11 11 10 1 + 1 0 1 1 1 = 1 0 0 1 0 0

Binary and decimal addition are only different in that the binary value 2 is equivalent to 10 in the decimal system. The superscripted 1's are carried-over digits. One common error to avoid when performing binary addition is the situation where 1 + 1 = 0, also has 1 carried over from its right column. The carried over 1 should be the value at the bottom, not 0. As you can see, the third column to the right of the above example shows this.

## Binary Subtraction

Binary addition is similar to decimal subtraction. The only difference is that binary and decimal subtraction are the same except for those which arise when you use only the digits 0. Borrowing is when the subtracted number is greater than the one it is subtracting from. Borrowing is only necessary when 1 is subtracted form 0. This causes to become "2" . The 0 in the borrowing columns is transformed into HTML1_, converting the 0-1 into 2 = 1. While reducing the 1 from the column being borrowed by by 1. If the next column is 0, borrowing must occur from each column until a column of 1 is obtained. For more information, refer to the following example.

Notice that the binary system is:

• 0 - 0 = 0
0 - 1 = 1, Borrow 1, which results in -1 carried forward
1 - 0 = 1
1 - 1 = 0

EX1:

 -11 20 1 1 1 - 0 1 1 0 1 = 0 1 0 1 0

EX2:

 -11 2-10 0 - 0 1 1 = 0 0 1

The superscripts are the changes to each bit that occur when borrowing. The borrowing column is basically 2 for borrowing and the borrowing column is 1 for borrowing.

## Binary Multiplication

Binary multiplication is simpler than its decimal counterpart. The only values that are used are 0 or 1, so the results you must add are either the same as the original term, or 0. You will notice that placeholder 0's must be added to each row and that the value is shifted to the right, as in decimal multiplication. Binary multiplication is complicated because of tedious binary addition, which depends on the number of bits in each term. For more information, see the following example.

Notice that the binary system is:

• 0 x 0. = 0
0 x 1 = 0.
1 x 0. = 0
1 x 1 = 1.

EX:

 1 0 1 1 1 x 1 1 1 0 1 1 1 + 1 0 1 1 1 0 = 1 0 0 0 1 0 1

The process of binary multiplication works the same way as decimal multiplication, as can be seen from the above example. The 0 placeholder is in the second line. The 0 placeholder is usually not visible in decimal multiplication. Although it's possible to do the same in this example, the 0 placeholder is assumed and not explicit. However, the 0 is important for any binary addition/subtraction calculator like the one on this page. It would be easy to overlook the 0 in the above binary addition/subtraction calculators. You should also remember that any 0 left of a 1 in the binary system is relevant. Any 0 to its right is irrelevant.

EX:

• 1 0 1 0 1 1 0 0
= 0 0 1 0 1 0 1 1 0 0
1 0 1 0 1 1 0 0 0 0

## Binary Division

Binary division is very similar to long division in decimal systems. The divisor still divides the dividend in the same way, the only difference being that binary subtraction is used instead of decimal. It is essential to have a solid understanding of binary subtraction in order to perform binary division. For more information, refer to the examples below and the section on binary subtraction. 