Open any color picker in a design tool and youβll see values like #FF6B35. Look at a file size and it says 4,096 bytes. Dig into any computer program and youβll find memory addresses, bit flags, and byte values. All of it traces back to two number systems: binary and hexadecimal.
Why Not Just Use Decimal?
Humans count in base-10 (decimal) because we have 10 fingers. Computers use base-2 (binary) because transistors β the building blocks of chips β have only two stable states: on (1) and off (0).
A single binary digit is called a bit. Eight bits make a byte, which can represent 256 different values (0β255).
Binary: Base-2
In binary, each position represents a power of 2:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
Reading the table above: 128 + 32 + 8 + 4 + 1 = 173 in decimal.
To convert decimal to binary, repeatedly divide by 2 and record the remainders:
173 Γ· 2 = 86 remainder 1
86 Γ· 2 = 43 remainder 0
43 Γ· 2 = 21 remainder 1
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 remainders bottom to top: 10101101 β
Hexadecimal: Base-16
Binary is precise but verbose. An 8-bit byte already needs 8 digits in binary. Hexadecimal (base-16) is a compact shorthand: every hex digit represents exactly 4 bits.
Hex digits go: 0 1 2 3 4 5 6 7 8 9 A B C D E F
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 10 | 1010 | A |
| 15 | 1111 | F |
| 173 | 10101101 | AD |
| 255 | 11111111 | FF |
A color like #FF6B35 is three hex bytes: red=FF (255), green=6B (107), blue=35 (53).
Where Youβll See These Systems
- Memory addresses:
0x7FFE4A21B3C0 - RGB colors:
#1A2B3C - File permissions:
chmod 755(octal, but same idea) - IP addresses (IPv6):
2001:0db8:85a3::8a2e:0370:7334 - Logic gates: every AND, OR, NOT gate operates on binary signals
Practice Tools
Our Binary & Hex Converter lets you convert between number systems instantly and see the bit-level representation. For the hardware side, explore Logic Gates and Computer Parts.
The best way to cement this is hands-on practice. Use the Binary & Hex tool to convert numbers until the pattern clicks.