What is Hexadecimal
Hexadecimal is a base 16 number system used in computing.
In comparison, the counting we learnt at primary school is actually a base 10 number system (often called decimal or denary), and binary is base 2.
Base 16 means that each position in a hexadecimal number comprises of one of 16 options.
Hex looks odd because we don’t have 16 original number symbols that we can use to represent these 16 possible options, so we have to use both numbers and letters from the alphabet.
E.g. We use “A” to represent ten. We cannot use “10” to represent ten, because 1 and 0 are symbols that have already been used in our number system to represent other numbers.
Symbols available for use in each number system:
Binary (base 2) | Decimal (base 10) | Hexadecimal (base 16) |
---|---|---|
0 | 0 | 0 |
1 | 1 | 1 |
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | 9 | |
A | ||
B | ||
C | ||
D | ||
E | ||
F |
Using a base 16 number system means that large numbers can be achieved using less positional spaces. Compare this to binary (base 2) which requires lots of bits (positional spaces) to create even small numbers.
Examples:
Base 2: 255
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Base 10: 255
100 | 10 | 1 |
---|---|---|
2 | 5 | 5 |
Base 16: 255
16 | 1 |
---|---|
F | F |
Our Uses of Hexadecimal page explains more about the many ways we use hex in computing.