The hexadecimal number system (hex) functions virtually identically to the decimal and binary systems. Instead of using a base of 10 or 2 respectively, it uses a base of 16.
Hex uses 16 digits including 0-9, just as the decimal system does, but also uses the letters A, B, C, D, E, and F (equivalent to a, b, c, d, e, f) to represent the numbers 10-15. Every hex digit represents 4 binary digits, called nibbles, which makes representing large binary numbers simpler.
For example, the binary value of 1010101010 can be represented as 2AA in hex. This helps computers to compress large binary values in a manner that can be easily converted between the two systems.
Typical Conversions Between Hex, Binary, and Decimal Values
Hex
Binary
Decimal
0
0
0
1
1
1
2
10
2
3
11
3
4
100
4
5
101
5
6
110
6
7
111
7
8
1000
8
9
1001
9
A
1010
10
B
1011
11
C
1100
12
D
1101
13
E
1110
14
F
1111
15
14
10100
20
3F
111111
63
Converting Between Decimal and Hex
Converting between decimal and hex involves understanding the place values of the different number systems. Converting between decimal and hex is quite similar to converting between decimal and binary. The ability to perform the conversion of either should make the other relatively simple.
Hex functions using the base of 16. This means that for the value 2AA, each place value represents a power of 16. Starting from the right:
The first “A” represents the “ones” place, or 160.
The second “A” represents 161.
The “2” represents 162.
Remember that “A” in hex is equivalent to 10 in decimal. Knowing this, you can convert from hex to decimal as shown: