
Binary Calculator
Free binary calculator: convert binary to decimal and back, and add, subtract, multiply or divide binary numbers with steps.
There was an error with your calculation.
Answer
101110110
| Answer | |
|---|---|
| Binary to Decimal | 10101010 = 170 |
| Decimal to Binary | 170 = 10101010 |
Binary calculator at a glance#
A binary calculator converts numbers between binary (base 2, only 0 and 1) and decimal (base 10), and adds, subtracts, multiplies or divides two binary numbers. To read a binary number, multiply each digit by its place value (1, 2, 4, 8, 16 and so on) and add the results. So binary 1010 is 10 in decimal, and binary 11111111 is 255.
Place values double from right to left. Binary 1010 breaks down as (1×8) + (0×4) + (1×2) + (0×1) = 8 + 0 + 2 + 0 = 10. To go the other way, divide the decimal number by 2 over and over and read the remainders from bottom to top: 10 gives remainders 0, 1, 0, 1, which is 1010.
| Decimal | Binary |
|---|---|
| 1 | 1 |
| 2 | 10 |
| 4 | 100 |
| 5 | 101 |
| 8 | 1000 |
| 10 | 1010 |
| 16 | 10000 |
| 100 | 1100100 |
| 255 | 11111111 |
Binary arithmetic follows the same carry and borrow rules as decimal, except you carry once a column reaches 2. For example, 1010 + 0011 is 1101, which is 10 + 3 = 13 in decimal. Enter your binary or decimal value in the calculator above for the exact conversion or the result of any operation, shown in both binary and decimal.
How the binary system works#
Binary is base 2, so each digit is either 0 or 1 and every place is worth twice the one to its right: 1, 2, 4, 8, 16, 32 and so on. Decimal counts 0 to 9 before it rolls over; binary rolls over after 1, so 2 in decimal is written 10 in binary. A leading zero never changes the value, the same way 06 and 6 are equal in decimal.
Converting between binary and decimal#
To read a binary number in decimal, multiply each digit by its place value and add. Binary 1010 is (1×8) + (0×4) + (1×2) + (0×1) = 10. To go from decimal to binary, divide by 2 over and over, write down each remainder, then read the remainders from bottom to top. The widget above does both directions instantly and shows the result in binary and decimal.
Binary arithmetic rules#
Addition, subtraction, multiplication and division work just like decimal, with carries and borrows happening at 2 instead of 10. In addition, 1 + 1 = 10, so you write 0 and carry 1. In subtraction you borrow from the next higher bit, which turns a 0 into 2 before you subtract. Multiplication is short, since any digit times 0 is 0 and times 1 is the number itself, and division follows the long-division pattern.
Binary calculator FAQ#
How do you convert binary to decimal?#
Multiply each binary digit by its place value (1, 2, 4, 8, 16 and so on, doubling from the right) and add the results. Binary 1010 is 8 + 0 + 2 + 0 = 10, and 11111111 is 255.
How do you convert decimal to binary?#
Divide the decimal number by 2 repeatedly, recording the remainder each time, then read the remainders bottom to top. Dividing 10 by 2 gives remainders 0, 1, 0, 1, which is 1010.
How do you add binary numbers?#
Add column by column from the right. When a column reaches 2 you carry 1, because 1 + 1 = 10 in binary. So 1010 + 0011 = 1101, which is 10 + 3 = 13 in decimal.
How do you subtract binary numbers?#
Subtract column by column and borrow when the top digit is smaller. Borrowing from the next bit turns a 0 into 2 (binary 10) before you subtract, the same idea as decimal borrowing.
Can a binary calculator handle negative numbers?#
Yes, usually with two's complement. The leading bit carries the sign, 0 for positive and 1 for negative, and the rest of the bits hold the value.
Why do computers use binary?#
A circuit is either on or off, which maps cleanly to 1 and 0. Each bit stands for a power of 2, so combinations of bits can represent any number, character or instruction.