Binary (Base 2) | Octal (Base 8) | Decimal (Base 10) | Hexadecimal (Base 16) |
---|---|---|---|
0 0 0 0 | 000 | 0 | 0x0 |
0 0 0 1 | 001 | 1 | 0x1 |
0 0 1 0 | 002 | 2 | 0x2 |
0 0 1 1 | 003 | 3 | 0x3 |
0 1 0 0 | 004 | 4 | 0x4 |
0 1 0 1 | 005 | 5 | 0x5 |
0 1 1 0 | 006 | 6 | 0x6 |
0 1 1 1 | 007 | 7 | 0x7 |
1 0 0 0 | 010 | 8 | 0x8 |
1 0 0 1 | 011 | 9 | 0x9 |
1 0 1 0 | 012 | 10 | 0xA |
1 0 1 1 | 013 | 11 | 0xB |
1 1 0 0 | 014 | 12 | 0xC |
1 1 0 1 | 015 | 13 | 0xD |
1 1 1 0 | 016 | 14 | 0xE |
1 1 1 1 | 017 | 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 16 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.