Binary Numbers: How Computers Count Using Only 0s and 1s
Published Apr 14, 2026 Β· 6 min read
Every photo, video, text message, and app on your device is ultimately stored as sequences of 0s and 1s. Binary (base-2) is the fundamental language of digital computing.
Why Binary?
Computers use electrical signals that are either ON (1) or OFF (0). It's far more reliable to detect two states than ten. Each binary digit (bit) is a tiny switch, and 8 bits form one byte β enough to represent 256 different values (2^8).
Binary to Decimal Conversion
Each position represents a power of 2, right to left:
| Binary | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | Decimal |
|---|---|---|---|---|---|---|---|---|---|
| 10110 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 22 |
| 11111111 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 255 |
10110 = 16 + 4 + 2 = 22
Decimal to Binary
Repeatedly divide by 2 and record remainders:
- 42 Γ· 2 = 21 remainder 0
- 21 Γ· 2 = 10 remainder 1
- 10 Γ· 2 = 5 remainder 0
- 5 Γ· 2 = 2 remainder 1
- 2 Γ· 2 = 1 remainder 0
- 1 Γ· 2 = 0 remainder 1
- Read bottom-up: 42 = 101010
Common Bit Sizes
| Unit | Bits | Range | Example Use |
|---|---|---|---|
| 1 bit | 1 | 0-1 | True/false flag |
| 1 byte | 8 | 0-255 | One ASCII character |
| 2 bytes | 16 | 0-65,535 | Unicode character |
| 4 bytes | 32 | 0-4.29 billion | IPv4 address, integer |
| 8 bytes | 64 | 0-18.4 quintillion | Modern integer, memory address |
Binary Operations
- AND: Both bits must be 1 β 1010 AND 1100 = 1000
- OR: Either bit is 1 β 1010 OR 1100 = 1110
- XOR: Bits differ β 1010 XOR 1100 = 0110 (used in encryption)
- NOT: Flip all bits β NOT 1010 = 0101
Try it: Use our Binary Calculator to convert between binary, decimal, hex, and perform binary operations.
π Sources: Khan Academy EPA