Binary Calculator — Math & Base Conversion
Perform addition, subtraction, multiplication, and division with binary numbers. Visualize bits and see decimal equivalents instantly.
Formula
Base-2 Arithmetic
Operations are performed on bits (0s and 1s) carrying values of powers of 2.
Worked Examples
Example 1: Binary Addition
Problem:Add 1010 and 0101 in binary.
Solution:Convert to check: 1010 = 8 + 2 = 10 and 0101 = 4 + 1 = 5. Column by column from the right, using 1 + 1 = 10 (write 0, carry 1): bit 0: 0 + 1 = 1 bit 1: 1 + 0 = 1 bit 2: 0 + 1 = 1 bit 3: 1 + 0 = 1 Result: 1111 Decimal check: 10 + 5 = 15, and 1111 = 8 + 4 + 2 + 1 = 15. Correct.
Result:1010 + 0101 = 1111 (decimal 15)
Example 2: Binary Multiplication by Shifting
Problem:Multiply 11 by 10 in binary, then 1011 by 100.
Solution:11 = 3 and 10 = 2, so the product should be 6. Multiplying by 10 (binary two) is a single left shift: 11 becomes 110. 110 = 4 + 2 = 6. Correct. Second case: 1011 = 11 and 100 = 4. Multiplying by 100 shifts left twice: 1011 becomes 101100. 101100 = 32 + 8 + 4 = 44, and 11 × 4 = 44. Correct. Every multiplication by a power of two is just a shift, which is why processors do it in a single cycle.
Result:11 × 10 = 110 (6) and 1011 × 100 = 101100 (44)
Example 3: Binary Subtraction with Borrowing
Problem:Subtract 0111 from 1100 in binary.
Solution:1100 = 12 and 0111 = 7, so the answer should be 5. Right to left, borrowing when the top bit is smaller: bit 0: 0 - 1 needs a borrow, giving 10 - 1 = 1 bit 1: after the borrow the top bit is 1 - 1(borrow) = 0, and 0 - 1 needs another borrow: 10 - 1 = 1 bit 2: 1 becomes 0 after that borrow, 0 - 1 borrows again: 10 - 1 = 1 bit 3: 1 becomes 0, and 0 - 0 = 0 Result: 0101 = 4 + 1 = 5. Correct.
Result:1100 - 0111 = 101 (decimal 5)
Frequently Asked Questions
What is Binary?
Binary is a base-2 number system that uses only two digits: 0 and 1. It is the fundamental language of computers, representing on/off states of transistors.
How do you add binary numbers?
0+0=0, 0+1=1, 1+0=1, 1+1=10 (0, carry 1). It is similar to decimal addition but carrying occurs at 2 instead of 10.
What is a bit and a byte?
A "bit" (binary digit) is a single 0 or 1. A "byte" is a group of 8 bits, capable of representing values from 0 to 255.
How do you convert binary to decimal?
Multiply each bit by 2 raised to the power of its position (from right to left, starting at 0). Example: 101 = 1×2² + 0×2¹ + 1×2⁰ = 4 + 0 + 1 = 5.
How do you subtract binary numbers?
Use borrowing, similar to decimal. 1-0=1, 1-1=0, 0-0=0. For 0-1, borrow from the next column to make it 10-1=1.
Why do computers use binary?
It is efficient and reliable for hardware. Logic gates are easily built to detect two voltage levels (high/low), minimizing errors compared to detecting 10 distinct levels.
What is Two's Complement?
A mathematical operation to represent negative numbers in binary. The most significant bit (leftmost) becomes the sign bit.
What is Hexadecimal?
Base-16. It acts as a shorthand for binary because 4 bits map perfectly to 1 hex digit (0-F). It is easier for humans to read than long strings of 1s and 0s.
How to multiply binary numbers?
It works like decimal long multiplication, but simpler because you only multiply by 0 or 1. 1×1=1, everything else is 0. Then add the shifted rows.
How do significant figures affect unit conversions?
Your converted result should have the same number of significant figures as your original measurement. If you measure 5.2 inches (2 significant figures), converting to centimeters gives 13 cm, not 13.208 cm. Using excessive decimal places implies false precision.
Background & Theory
Binary Arithmetic:
Addition Rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (0, carry 1)
- 1 + 1 + 1 = 11 (1, carry 1)
Subtraction Rules:
- 0 - 0 = 0
- 1 - 0 = 1
- 1 - 1 = 0
- 0 - 1 = 1 (borrow from next column)
Place Value:
Each position represents a power of 2.
... $2^3$ | $2^2$ | $2^1$ | $2^0$
... 8 | 4 | 2 | 1
Example: 1011 = $1\\times8 + 0\\times4 + 1\\times2 + 1\\times1 = 11$