Binary Calculator
Perform arithmetic operations in Binary number system. Enter two binary numbers and select an operation.
About Binary Calculator
The Binary Calculator allows you to perform addition, subtraction, multiplication, and division operations directly in the binary number system without converting to decimal first.
How the Binary Calculator Works
A binary calculator performs arithmetic operations — addition, subtraction, multiplication, and division — directly on base-2 numbers. Instead of carrying at 10 (as in decimal), binary arithmetic carries at 2. This is exactly how your computer's processor performs every calculation at the hardware level.
- Enter two binary numbers (using only 0s and 1s)
- Select an operation: +, −, ×, or ÷
- The calculator converts both to decimal, performs the operation, and converts the result back to binary
Binary Arithmetic Rules
Addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (0 carry 1)
Subtraction: 0−0=0, 1−0=1, 1−1=0, 10−1=1 (borrow from next column)
Multiplication: 0×0=0, 0×1=0, 1×0=0, 1×1=1
Division: Same long division as decimal, but only with 0 and 1
Worked Example: 1010 + 1101
1010 (10 in decimal)
+ 1101 (13 in decimal)
------
Column 0 (rightmost): 0+1 = 1
Column 1: 1+0 = 1
Column 2: 0+1 = 1
Column 3: 1+1 = 10 → write 0, carry 1
Column 4: carry 1
Result: 10111₂ = 23₁₀
Verification: 10 + 13 = 23 ✓
Technical Details
Binary arithmetic is the foundation of all digital computation. CPUs use binary adders built from logic gates (AND, OR, XOR) to perform addition, and derive subtraction using two's complement representation. Multiplication is implemented as repeated addition with bit shifting, and division as repeated subtraction. This calculator performs integer arithmetic — the division operation returns the integer quotient (floor division). Results are limited by JavaScript's safe integer range (2⁵³ − 1).
Frequently Asked Questions
What is 1111 + 1 in binary?
1111 + 1 = 10000. In decimal, this is 15 + 1 = 16. The carry propagates through all four columns.
How does binary subtraction work?
Binary subtraction uses borrowing, just like decimal. When subtracting 1 from 0, you borrow from the next column (making it 10 − 1 = 1 in binary). Computers typically use two's complement to convert subtraction into addition.
Can binary numbers be negative?
In computing, negative binary numbers are represented using two's complement: invert all bits and add 1. For example, −5 in 8-bit two's complement is 11111011. This calculator works with unsigned (positive) integers.
What is binary multiplication?
Binary multiplication follows the same process as long multiplication in decimal, but simpler — each partial product is either 0 (multiply by 0) or a shifted copy of the multiplicand (multiply by 1). For example, 101 × 11 = 101 + 1010 = 1111 (5 × 3 = 15).
How to Perform Binary Arithmetic (Add, Subtract, Multiply, Divide in Base-2)
Binary arithmetic is how every computer processor performs calculations. The same addition, subtraction, multiplication, and division you know in decimal work in binary, but with only two digits (0 and 1). Understanding binary arithmetic helps you understand ALU (Arithmetic Logic Unit) design, bitwise operations, and how overflow errors occur.
- Binary Addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (0 carry 1), 1+1+1=11 (1 carry 1).
- Binary Subtraction: Use two's complement — invert the subtrahend bits and add 1, then add to the minuend.
- Binary Multiplication: Multiply each bit of the multiplier by the multiplicand, shift left for each position, then add all partial products.
- Binary Division: Use long division with binary — subtract the divisor from the dividend portions, recording 1 when it fits and 0 when it does not.
- Always check for overflow: adding two positive numbers that result in a negative (MSB becomes 1) indicates signed overflow.
Binary Arithmetic: Key Results
Common binary calculations and their results:
| Input | Output |
|---|---|
| 1010 + 0101 | 1111 |
| 1111 + 0001 | 10000 |
| 1100 - 0011 | 1001 |
| 0110 × 0011 | 10010 |
| 1000 ÷ 0010 | 100 |
| 1111 + 1111 | 11110 |
| 10000 - 00001 | 1111 |
| 1010 × 0010 | 10100 |
| 11111111 + 1 | 100000000 |
| 1100 ÷ 0100 | 11 |
Solved Examples: Binary Arithmetic
Question 1: Add binary 10110 and 01101.
Solution:
Align right: 10110 + 01101
Column 0: 0+1=1
Column 1: 1+0=1
Column 2: 1+1=10, write 0 carry 1
Column 3: 0+1+1(carry)=10, write 0 carry 1
Column 4: 1+0+1(carry)=10, write 0 carry 1
Carry out: 1
Result: 100011
Answer: 10110₂ + 01101₂ = 100011₂ (22 + 13 = 35 ✓).
Question 2: Subtract binary 0101 from 1100 using two's complement (4-bit).
Solution:
Minuend: 1100 (12₁₀)
Subtrahend: 0101 (5₁₀)
Two's complement of 0101: invert→1010, add 1→1011
Add: 1100 + 1011 = 10111 (discard carry beyond 4 bits = 0111)
Answer: 1100₂ - 0101₂ = 0111₂ (12 - 5 = 7 ✓). The discarded carry confirms a positive result.
Question 3: Multiply binary 101 by 110.
Solution:
101 × 0 (LSB of 110) = 000 (shift 0)
101 × 1 (middle bit) = 101 (shift 1) → 1010
101 × 1 (MSB) = 101 (shift 2) → 10100
Add partial products: 000 + 1010 + 10100 = 11110
Answer: 101₂ × 110₂ = 11110₂ (5 × 6 = 30 ✓).
Question 4: Divide binary 11010 by 101.
Solution:
11010 ÷ 101 (26 ÷ 5)
101 fits into 110? Yes (110-101=001). Quotient: 1.
Bring down 1: 0011. 101 fits? No. Quotient: 10.
Bring down 0: 00110. 101 fits? Yes (110-101=001). Quotient: 101.
Remainder: 1 (26 = 5×5 + 1)
Answer: 11010₂ ÷ 101₂ = 101₂ remainder 1₂ (26 ÷ 5 = 5 R1 ✓).
Practice: Binary Arithmetic
Try solving these on your own to test your understanding:
- Add 1011 + 1101. (Answer: 11000, which is 11+13=24)
- Subtract 1010 - 0011 using two's complement. (Answer: 0111, which is 10-3=7)
- Multiply 111 × 101. (Answer: 100011, which is 7×5=35)
- Divide 10000 ÷ 100. (Answer: 100, which is 16÷4=4)
- Add 11111111 + 00000001. (Answer: 100000000, which is 255+1=256)
- What is 1000 - 0001 in binary? (Answer: 0111, which is 8-1=7)
How CPUs Actually Add: The Full Adder Circuit
A CPU adds binary numbers using chains of full adders. Each full adder takes 3 inputs (bit A, bit B, carry-in) and produces 2 outputs (sum, carry-out). An 8-bit adder chains 8 full adders, with carry rippling from LSB to MSB. This "ripple carry adder" is simple but slow for wide numbers because each bit must wait for the previous carry. Modern CPUs use carry-lookahead adders that calculate carries in parallel, enabling 64-bit addition in a single clock cycle.
Overflow Detection in Signed Binary
Signed overflow occurs when adding two numbers of the same sign produces a result with the opposite sign. In 8-bit signed: 01111111 + 00000001 = 10000000 (127 + 1 = -128 — overflow!). CPUs detect this by XORing the carry into the MSB with the carry out of the MSB. If they differ, overflow occurred. Programmers must check overflow flags or use wider types to prevent bugs in financial calculations, game physics, and security-critical code.
Key Takeaways
- Binary addition: 1+1=10 (sum 0, carry 1). Chain carries left like decimal.
- Subtraction uses two's complement: invert bits, add 1, then add.
- Multiplication is shift-and-add: each 1-bit in the multiplier adds a shifted copy.
- Division uses binary long division: subtract divisor, record 1 or 0.
- Overflow occurs when the result exceeds the bit width (255+1=0 in 8-bit unsigned).
- CPUs perform all arithmetic in binary using adder circuits.