Binary Calculator — Add, Subtract, Multiply & Convert to Decimal
Perform binary arithmetic and convert between binary and decimal. Covers addition, subtraction, two's complement for negative numbers, and multiplication with examples.
Every piece of data in your computer — text, images, code, this webpage — is ultimately stored as binary. Understanding how binary arithmetic works gives you real insight into how CPUs think. Do your binary calculations with the CalcHub Binary Calculator.
Binary to Decimal Conversion
Binary is base-2: each position is a power of 2, right to left starting from 2⁰.
Convert 1011₂ to decimal:| Bit | Position | Power | Value |
|---|---|---|---|
| 1 | 3 | 2³ | 8 |
| 0 | 2 | 2² | 0 |
| 1 | 1 | 2¹ | 2 |
| 1 | 0 | 2⁰ | 1 |
Binary Addition
Rules: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1)
Example: 1101₂ + 1011₂ 1 1 0 1 (13)
+ 1 0 1 1 (11)
---------
1 1 0 0 0 (24)
Carry happens twice. Result: 11000₂ = 24₁₀ ✓
Binary Subtraction
Rules: 0−0=0, 1−0=1, 1−1=0, 10−1=1 (borrow 1 from next column)
Example: 1101₂ − 0110₂ (13 − 6 = 7) 1 1 0 1
- 0 1 1 0
---------
0 1 1 1 (7)
Result: 0111₂ = 7₁₀ ✓
Two's Complement (Negative Numbers)
Computers represent negative numbers using two's complement — it makes subtraction the same as addition, simplifying hardware design enormously.
To negate a binary number:- Flip all bits (one's complement)
- Add 1
Binary Multiplication
Uses the same repeated shift-and-add method as long multiplication.
Example: 101₂ × 11₂ (5 × 3 = 15) 1 0 1
× 1 1
---------
1 0 1 (101 × 1)
1 0 1 0 (101 × 1, shifted left 1)
---------
1 1 1 1 = 15₁₀
Powers of 2 Reference
| Power | Value |
|---|---|
| 2⁰ | 1 |
| 2¹ | 2 |
| 2² | 4 |
| 2³ | 8 |
| 2⁴ | 16 |
| 2⁵ | 32 |
| 2⁶ | 64 |
| 2⁷ | 128 |
| 2⁸ | 256 |
| 2¹⁰ | 1,024 (1 KB) |
| 2²⁰ | 1,048,576 (1 MB) |
Why does a computer use binary instead of decimal?
Physical hardware — transistors, capacitors — naturally represents two states: on/off, charged/uncharged, high voltage/low voltage. Implementing a reliable 10-state system would require much more complex and error-prone circuitry. Binary maps perfectly onto these two physical states.
What's the range of an 8-bit signed integer?
Using two's complement: −128 to +127. The leading bit is the sign bit. For unsigned 8-bit: 0 to 255. This is why early video games had a "256" boundary — coordinates or health points stored in one byte.
What does it mean to "shift" bits?
Left shift (<<) multiplies by powers of 2: 0101 << 1 = 1010 (5 × 2 = 10). Right shift (>>) divides. Bitwise shifts are extremely fast on hardware and commonly used in performance-critical code as a substitute for multiplication/division by powers of 2.