March 28, 20264 min read

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.

binary binary calculator number systems two's complement calchub
Ad 336x280

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:
BitPositionPowerValue
138
020
112
102⁰1
1×8 + 0×4 + 1×2 + 1×1 = 11₁₀ Convert decimal 42 to binary: 42 ÷ 2 = 21 R 0 21 ÷ 2 = 10 R 1 10 ÷ 2 = 5 R 0 5 ÷ 2 = 2 R 1 2 ÷ 2 = 1 R 0 1 ÷ 2 = 0 R 1 Read remainders bottom-up: 101010₂

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:
  1. Flip all bits (one's complement)
  2. Add 1
Example: Represent −13 in 8-bit two's complement 13 in binary: 00001101 Flip bits: 11110010 Add 1: 11110011 Verify: 11110011₂ = 243₁₀... but in 8-bit signed representation, the leading 1 means it's negative. 256 − 243 = 13. So 11110011 = −13. ✓

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

PowerValue
2⁰1
2
4
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.

Ad 728x90