Binary Calculator
Perform arithmetic on binary (base-2) numbers and convert between binary and decimal. Enter binary values (digits 0 and 1 only) and select the operation.
Binary Calculator — How to Convert Binary to Decimal and Perform Binary Arithmetic
Binary is the number system that powers every computer, smartphone, and digital device on Earth. While humans naturally use the decimal (base-10) system, computers work with base-2 — two digits, 0 and 1, corresponding to the off and on states of electronic transistors. Understanding binary is fundamental to computer science, digital electronics, and programming.
What Is Binary (Base-2)?
The binary number system uses only two digits: 0 and 1. Each digit in a binary number is called a bit (binary digit). Groups of bits form larger units:
| Unit | Bits | Max value |
|---|---|---|
| Bit | 1 | 1 |
| Nibble | 4 | 15 |
| Byte | 8 | 255 |
| Word | 16 | 65,535 |
| Double Word | 32 | ~4.3 billion |
How to Convert Binary to Decimal Step by Step
Each position in a binary number represents a power of 2, starting at 2⁰ = 1 on the right and doubling with each position to the left.
Positional values:
```
Position: 7 6 5 4 3 2 1 0
Value: 128 64 32 16 8 4 2 1
```
Example: Convert 1011₂ to decimal
1. Write the binary digits with their positional values: 1×8, 0×4, 1×2, 1×1
2. Multiply: 8 + 0 + 2 + 1 = 11₁₀
Example: Convert 11010110₂ to decimal
- 1×128 + 1×64 + 0×32 + 1×16 + 0×8 + 1×4 + 1×2 + 0×1
- = 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = 214₁₀
How to Convert Decimal to Binary
The method is repeated division by 2 — divide the number by 2, record the remainder, and continue dividing the quotient until you reach 0. Read the remainders from bottom to top.
Example: Convert 45₁₀ to binary
| Division | 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** |
Read remainders bottom to top: 101101₂
Verify: 32 + 0 + 8 + 4 + 0 + 1 = 45 ✓
Binary Addition
Binary addition uses the same column-by-column approach as decimal, but with only two digits:
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Example: 1011₂ + 0111₂
```
1011
+ 0111
------
10010
```
= 10010₂ = 18₁₀ (11 + 7 = 18 ✓)
Binary Subtraction
Binary subtraction works by borrowing from the next column when subtracting 1 from 0 (just as you borrow 10 when subtracting a larger decimal digit from a smaller one).
Example: 1100₂ − 0101₂
- 1100 = 12₁₀, 0101 = 5₁₀
- 12 − 5 = 7 = 0111₂
Binary Multiplication
Binary multiplication is actually simpler than decimal because you only ever multiply by 0 or 1:
- Any number × 0 = 0
- Any number × 1 = that number
Then add the partial products using binary addition.
Example: 101₂ × 11₂ (5 × 3 = 15)
```
101
× 11
------
101 (101 × 1)
1010 (101 × 1, shifted left)
------
1111
```
= 1111₂ = 15₁₀ ✓
Why Computers Use Binary
Computers use binary because transistors — the fundamental building blocks of processors — have two stable states:
- 0 = low voltage (off)
- 1 = high voltage (on)
This binary physical property maps perfectly to binary arithmetic. Storing or transmitting a value with just two states is extremely reliable — a transistor is either on or off, unlike analogue systems where signal degradation is a problem.
Modern processors have billions of transistors, each performing binary operations billions of times per second.
Binary in Computer Science
IP Addresses: IPv4 addresses are 32 bits. 192.168.1.1 in binary:
- 192 = 11000000, 168 = 10101000, 1 = 00000001, 1 = 00000001
ASCII: Text characters are encoded as binary numbers. The letter 'A' is 65₁₀ = 01000001₂.
Colours: RGB colour values are each 8-bit numbers (0–255). The colour white = 11111111 11111111 11111111₂.
Related Resources
Related Calculators
- Hex Calculator — Convert binary numbers to hexadecimal.
- Percentage Calculator — Compute fractional values.
External Authority Resources
- Wikipedia: Binary Number System — Thorough history and operations of base-2.
- Wolfram MathWorld: Binary — Technical details of binary notation.
Frequently Asked Questions
Write out the binary digits from right to left. Each position represents a power of 2 (starting at 2⁰ = 1). Multiply each digit by its position value and add the results. For example, 1011₂ = (1×8) + (0×4) + (1×2) + (1×1) = 11₁₀.
Binary addition follows the same rules as decimal but with only two digits: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1). Work right to left, carrying when the sum reaches 2.
Computers use binary because electronic circuits have two reliable states: on (1) and off (0). This maps directly to voltage levels (high/low), making binary the most practical number system for digital electronics.
8 bits (one byte) can represent values from 0 to 255. The largest value is 11111111₂ = 255₁₀. With a sign bit, the range is -128 to 127.
Repeatedly divide the decimal number by 2 and record the remainders from bottom to top. For example: 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1. Read remainders upward: 1101₂.