Hexadecimal (or hex) is a base 16 system used to simplify how binary is represented. A hex digit can be any of the following 16 digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F.

Each hex digit reflects a 4-bit binary sequence.

This means an 8-bit binary number can be written using only two different hex digits – one hex digit for each nibble (or group of 4-bits). It is much easier to write numbers as hex than to write them as binary numbers.

For example:

• 11010100 in binary would be D4 in hex
• FFFF3 in hex would be 11111111111111110011 in binary

This table shows each hex digit with the equivalent values in binary and denary.

0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

Hex codes are used in many areas of computing to simplify binary codes. It is important to note that computers do not use hexadecimal – it is used by humans to shorten binary to a more easily understandable form. Hexadecimal is translated into binary for computer use. Some examples of where hex is used include:

• Colour references
• Assembly language programs
• Error messages

To represent the denary number 12 in a computer system, you could use binary 1100 or hex value C.

To convert a 4-bit binary number to hex:

Binary Denary Hex
1100 (1×8) + (1×4) + (0x2) + (0x1) = 12 C

A byte is made of eight binary digits. To convert an 8-bit binary number to hex, separate it into two nibbles or two half-bytes.

Binary Denary Hex
1011 1001 11 and 9 B9