Base 16 - Hexadecimal
Base 16, or hexadecimal, throws another wrench into things. Although
hexadecimal works exactly the same as base 10 and binary. An untrained mind might
think, "okay, I get it. Instead of counting to 9, we count to 15," but this is
only kind of true.
Hexadecimal, or hex for short, counts to F...
hear me out, I promise it makes sense. If we think about what
we've learned about number systems, we can't just count to 15.
Note, 15 is a base 10 number; 15 is 1 tens place
and 5 ones place, so what we do is represent the numbers
after 9 with letters.
Nonetheless, hexadecimal works the same as the other two
number systems. Except now we have the ones place,
sixteeens place, two hundred fifty six place, etc. Each place value
is a multiple of 16.
What does this look like?
Let's count to 15 in hexadecimal.
- Base 16
- 0x00
- 0x01
- 0x02
- 0x03
- 0x04
- 0x05
- 0x06
- 0x07
- 0x08
- 0x09
- 0x0A
- 0x0B
- 0x0C
- 0x0D
- 0x0E
- 0x0F
- Base 2
- 0000
- 0001
- 0010
- 0011
- 0100
- 0101
- 0110
- 0111
- 1000
- 1001
- 1010
- 1011
- 1100
- 1101
- 1110
- 1111
- Base 10
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
Note: hexadecimal is typically prefixed with
0x
0xAF (Base10: 175) The thirty-two's place
is A, and the ones's place is F. If we add 1, this will
increment the sixteens's place by one and decrement the
ones's place to 0; 0xB0 (Base10: 176)
0x1A (Base10: 26) The sixteen's place
is 1, and the one's place is A. If we subtract
by 1, this will decrement the one's place by 1; 0x19
(Base10: 25)