## Why Binary Exists
Computers don't think in tens โ they think in twos. Every piece of data your computer processes, stores, or transmits is ultimately represented as a sequence of 1s and 0s. Understanding binary isn't just academic: it underlies how file sizes work, why color values are written as #FF5733, and what your network subnet mask actually means.
Our [binary calculator](/category/math/binary-calculator) handles conversions instantly. This guide shows you how the conversion works so you can do it yourself โ or verify what the tool gives you.
---
## The Core Concept: Place Values
Decimal (base-10) uses place values that are powers of 10:
| Position | 10ยณ | 10ยฒ | 10ยน | 10โฐ |
|----------|-----|-----|-----|-----|
| Value | 1000 | 100 | 10 | 1 |
Binary (base-2) uses place values that are powers of 2:
| Position | 2โท | 2โถ | 2โต | 2โด | 2ยณ | 2ยฒ | 2ยน | 2โฐ |
|----------|----|----|----|----|----|----|----|----|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
To convert binary to decimal: multiply each binary digit by its place value, then add the results.
---
## Binary to Decimal: Step-by-Step
### Method: Positional Multiplication
Write out the binary number, assign place values right to left, multiply each digit by its value, sum the results.
**Example: Convert 1011 to decimal**
| Bit | 1 | 0 | 1 | 1 |
|-----|---|---|---|---|
| Place value | 2ยณ=8 | 2ยฒ=4 | 2ยน=2 | 2โฐ=1 |
| Result | 1ร8=8 | 0ร4=0 | 1ร2=2 | 1ร1=1 |
> 8 + 0 + 2 + 1 = **11**
Binary 1011 = Decimal 11 โ
**Example: Convert 11010110 to decimal**
| Bit | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
|-----|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Result | 128 | 64 | 0 | 16 | 0 | 4 | 2 | 0 |
> 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = **214**
[Verify with the binary calculator โ](/category/math/binary-calculator)
---
## Decimal to Binary: The Division Method
To go the other direction โ decimal to binary โ divide by 2 repeatedly and read the remainders 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** โ
---
## Quick Reference: Decimal 0โ20 in Binary
| Decimal | Binary | Decimal | Binary |
|---------|--------|---------|--------|
| 0 | 0000 | 11 | 1011 |
| 1 | 0001 | 12 | 1100 |
| 2 | 0010 | 13 | 1101 |
| 3 | 0011 | 14 | 1110 |
| 4 | 0100 | 15 | 1111 |
| 5 | 0101 | 16 | 10000 |
| 6 | 0110 | 17 | 10001 |
| 7 | 0111 | 18 | 10010 |
| 8 | 1000 | 19 | 10011 |
| 9 | 1001 | 20 | 10100 |
| 10 | 1010 | | |
---
## Binary in the Real World
### File Sizes: Bits and Bytes
A **bit** is one binary digit (0 or 1). A **byte** is 8 bits.
8 bits can represent 2โธ = 256 different values (0 through 255). That's why:
- RGB color values run 0โ255 per channel
- Old ASCII used 7 bits (128 characters); extended ASCII uses 8 bits (256)
- A single byte can store exactly one character in basic ASCII
| Unit | Bits | Values Possible |
|------|------|-----------------|
| 1 bit | 1 | 2 (0 or 1) |
| 1 nibble | 4 | 16 |
| 1 byte | 8 | 256 |
| 2 bytes | 16 | 65,536 |
| 4 bytes | 32 | ~4.3 billion |
### Hex Colors: Binary in Disguise
The hex color code #FF5733 is three pairs of hexadecimal (base-16) numbers:
- FF = 255 red
- 57 = 87 green
- 33 = 51 blue
Each hex digit maps to exactly 4 binary bits (a nibble):
- F = 1111 in binary
- FF = 11111111 = 255 decimal
This is why web colors are written in hex โ it's a compact representation of three 8-bit binary values.
### IPv4 Addresses and Subnet Masks
An IPv4 address like 192.168.1.1 is four decimal numbers, each representing one byte (0โ255). In binary:
> 192 = 11000000
> 168 = 10101000
> 1 = 00000001
> 1 = 00000001
The subnet mask 255.255.255.0 in binary is:
> 11111111.11111111.11111111.00000000
The 1s mark the network portion; the 0s mark the host portion. A /24 subnet (24 ones) = 255.255.255.0 โ it literally means the first 24 bits identify the network.
---
## Binary Arithmetic
### Addition
Binary addition has four rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (zero, carry 1)
**Example: 1011 + 0110**
```
1011
+ 0110
------
10001 (= 17 + 6 = 23? No: 11 + 6 = 17)
```
Check: 1011 = 11, 0110 = 6, sum = 17 = 10001 โ
### Why This Matters
Every addition your CPU performs at the hardware level follows these four rules, repeated across 32 or 64 bit positions simultaneously. Modern processors execute billions of these operations per second.
---
## Binary, Octal, and Hexadecimal
Three number systems work naturally with binary because they're all powers of 2:
| System | Base | Bits per digit | Used for |
|--------|------|---------------|----------|
| Binary | 2 | 1 | Machine code, logic |
| Octal | 8 | 3 | Unix file permissions (chmod 755) |
| Hexadecimal | 16 | 4 | Color codes, memory addresses, checksums |
Converting binary to hex: group bits in fours from right, convert each group.
**11010110 in hex:**
- 1101 = D (13 in decimal)
- 0110 = 6
- Result: **0xD6**
Verify: 0xD6 = 13ร16 + 6 = 208 + 6 = 214 (matches our earlier example) โ
---
## Related Math Calculators
- [Binary Calculator](/category/math/binary-calculator) โ convert, add, subtract, and multiply in binary
- [
Percentage Calculator](/category/math/percentage-calculator) โ all 5 types of percentage problems
- [
Scientific Calculator](/category/math/scientific-calculator) โ powers, roots, and scientific notation
- [Standard Deviation Calculator](/category/math/standard-deviation-calculator) โ statistics for any data set
---
## Frequently Asked Questions
**How do you convert binary to decimal?**
Write out the binary digits, assign place values (1, 2, 4, 8, 16โฆ right to left), multiply each digit by its place value, and sum the results. Binary 1010 = 0ร1 + 1ร2 + 0ร4 + 1ร8 = **10**.
**What is 1111 in decimal?**
1ร8 + 1ร4 + 1ร2 + 1ร1 = **15**. A 4-bit number maxes out at 1111 = 15 = one hex digit F.
**What is 255 in binary?**
255 = 11111111 โ eight 1-bits, which is the maximum value for one byte (2โธ โ 1 = 255). This is why RGB color values and IP address octets cap at 255.
**Why do computers use binary instead of decimal?**
Electronic circuits have two stable states: on (high voltage) and off (low voltage). Binary maps directly to these states โ 1 = on, 0 = off. Representing 10 distinct states (0โ9) in hardware reliably would require far more complex circuitry and be more prone to errors.