Use this free binary calculator to do arithmetic on binary (base-2) numbers. You can add, subtract, multiply, and divide binary numbers, convert between binary, decimal, hexadecimal, and octal, find two’s complement, and use bitwise operations such as AND, OR, XOR, NOT, and shifts. The calculator shows the answer in binary and in decimal, with the steps. No signup needed.
Arithmetic:
1011.Binary is a number system with only two digits, 0 and 1. It is also called base 2. Computers use binary because electronic circuits have two states, on and off.
In decimal (base 10), each place is worth 10 times the one to its right. In binary, each place is worth 2 times the one to its right.
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
So the binary number 101101 means 32 + 8 + 4 + 1 = 45.
One binary digit is a bit. Eight bits make a byte.
Addition
| Sum | Result |
|---|---|
| 0 + 0 | 0 |
| 0 + 1 | 1 |
| 1 + 0 | 1 |
| 1 + 1 | 10 (write 0, carry 1) |
| 1 + 1 + 1 | 11 (write 1, carry 1) |
| Difference | Result |
|---|---|
| 0 − 0 | 0 |
| 1 − 0 | 1 |
| 1 − 1 | 0 |
| 0 − 1 | 1, with a borrow of 1 from the next place |
1011 + 110
1011 (11)
+ 110 (6)
------
10001 (17)Answer: 10001 (17 in decimal).
1101 − 101
1101 (13)
− 101 (5)
------
1000 (8)Answer: 1000 (8 in decimal).
101 × 11
101 (5)
× 11 (3)
-----
101 (101 × 1)
1010 (101 × 1, shifted left by 1)
-----
1111 (15)Answer: 1111 (15 in decimal).
1101 ÷ 11 (13 ÷ 3)
Check: 100 × 11 = 1100, and 1100 + 1 = 1101.
10110 × 101 (22 × 5)
Answer: 1101110 (110 in decimal).
11001 ÷ 101 (25 ÷ 5)
Answer: 101 (5), with a remainder of 0.
1111 + 1 = 10000 (15 + 1 = 16)111 × 111 = 110001 (7 × 7 = 49)101 − 1101 (5 − 13)
Answer: −1000 (−8 in decimal).
Add the place values where the digit is 1.
101101 = 32 + 8 + 4 + 1 = 4511111111 = 25510000000 = 128Divide by 2 again and again, and read the remainders from the bottom up.
For 45:
| Divide | Quotient | Remainder |
|---|---|---|
| 45 ÷ 2 | 22 | 1 |
| 22 ÷ 2 | 11 | 0 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
More conversions:
Take 11010110.
101.101 = 4 + 1 + 0.5 + 0.125 = 5.625
To convert 0.625 to binary, multiply by 2 and take the whole part each time: 0.625 × 2 = 1.25 (1), 0.25 × 2 = 0.5 (0), 0.5 × 2 = 1.0 (1). So 0.625 = 0.101.
Some decimal fractions, such as 0.1, repeat forever in binary (0.0001100110011…), which is one reason computers show tiny rounding differences.
Two’s complement is how computers store negative integers.
To find −45 in 8 bits:
001011011101001011010011So −45 = 11010011.
More 8-bit examples:
To compute 13 − 5 in 8 bits, add 13 and −5:
00001101 (13)
+ 11111011 (−5)
----------
1 00001000 (carry out, ignore it)The result is 00001000 = 8.
00101100 = 44, with a carry out.11001000, which reads as −56. This is a signed overflow.With 1100 (12) and 1010 (10):
| Operation | Result | Decimal |
|---|---|---|
| AND | 1000 | 8 |
| OR | 1110 | 14 |
| XOR | 0110 | 6 |
NOT flips each bit. In 8 bits, NOT 00001100 = 11110011.
0101 shifted left by 1 = 1010 (5 → 10, which doubles it)1100 shifted right by 2 = 0011 (12 → 3, which divides by 4)| Bits | Unsigned range | Signed range (two’s complement) |
|---|---|---|
| 4 | 0 to 15 | −8 to 7 |
| 8 | 0 to 255 | −128 to 127 |
| 16 | 0 to 65,535 | −32,768 to 32,767 |
| 32 | 0 to 4,294,967,295 | −2,147,483,648 to 2,147,483,647 |
| Decimal | Binary | Hex | Octal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| 10 | 1010 | A | 12 |
| 11 | 1011 | B | 13 |
| 12 | 1100 | C | 14 |
| 13 | 1101 | D | 15 |
| 14 | 1110 | E | 16 |
| 15 | 1111 | F | 17 |
01000001, or 65)11111111 is 255 unsigned, but −1 in 8-bit two’s complement.1101 0110.Binary is a number system that uses only the digits 0 and 1. It is base 2, and each place is worth twice the place to its right.
Add them column by column, from right to left, and carry 1 when a column adds up to 2 or more. For example, 1011 + 110 = 10001.
Subtract column by column and borrow from the next place when you need to. For example, 1101 − 101 = 1000. You can also add the two’s complement of the second number.
Write a partial product for each digit of the second number (0 or a copy of the first number, shifted left) and add them. 101 × 11 = 1111.
Use long division. At each step, the divisor either fits (1) or does not fit (0). 1101 ÷ 11 gives a quotient of 100 and a remainder of 1.
Add the place values (1, 2, 4, 8, and so on) wherever there is a 1. For example, 101101 = 32 + 8 + 4 + 1 = 45.
Divide by 2 repeatedly and read the remainders from the bottom up. For 45, the result is 101101.
Group the bits in fours from the right, and replace each group with a hex digit. 11010110 becomes 1101 0110, which is D6.
It is the standard way to store negative integers. To find the two’s complement of a number, flip all the bits and add 1. In 8 bits, −5 is 11111011.
Overflow happens when a result is too large for the number of bits. For example, 200 + 100 in 8-bit unsigned numbers gives 44 with a carry out.
They work on the individual bits of numbers. AND, OR, and XOR compare two numbers bit by bit, NOT flips every bit, and shifts move the bits left or right.
Yes. It is free, with no registration and no limits.
Binary arithmetic on integers is exact. Fractions may be rounded for display, since some decimal fractions repeat in binary.
A few of the most-used tools in each hub.
This calculator is for general and educational use. Integer results are exact within the range you choose, and fractional results may be rounded for display. Check important results yourself before using them for programming, hardware design, security, or graded work, and follow your teacher’s rules on notation and bit width.