Binary (Base 2) | Decimal (Base 10) | Hexadecimal (Base 16) |
---|---|---|
0 0 0 0 | 0 | 0x0 |
0 0 0 1 | 1 | 0x1 |
0 0 1 0 | 2 | 0x2 |
0 0 1 1 | 3 | 0x3 |
0 1 0 0 | 4 | 0x4 |
0 1 0 1 | 5 | 0x5 |
0 1 1 0 | 6 | 0x6 |
0 1 1 1 | 7 | 0x7 |
1 0 0 0 | 8 | 0x8 |
1 0 0 1 | 9 | 0x9 |
1 0 1 0 | 10 | 0xA |
1 0 1 1 | 11 | 0xB |
1 1 0 0 | 12 | 0xC |
1 1 0 1 | 13 | 0xD |
1 1 1 0 | 14 | 0xE |
1 1 1 1 | 15 | 0xF |
Note the patterns with the 1's and 0's as we count in binary. They correlate with the position value.
Why 15 (decimal)? That's how many values it takes to represent all 15 single-hexdigit values.
Why hex? Because 2^4 = 16, it takes 4 binary bits to represent 1 hex digit (or, each hex digit represents 4 binary bits). We use hex because it is a shorthand way of representing binary.
Shorthand is good because it gives us less chance to make mistakes. That's really pretty much the story with that one.