There are 16 different hex digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, or f

 Hex Digit 0 1 2 3 4 5 6 7 8 9 a b c d e f Decimal Value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary Value 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

#### Place Value Table

 161 160 16 1

Example 1: Convert the hex number 5e to decimal.

Step 1: Multiply each hex digit by its place value.

Step 2: Add the resulting numbers.

 16 1 5 e 5 × 16 = 80 14 × 1 = 15 80  + 15 =    95

Example 2: Convert the 4-bit binary number 1110 to hex.

Find the hex digit by looking it up in the table.

1110 = e

Example 3: Convert the 8-bit binary number 01101110 to hex.

 Step 1: Separate the binary digits into groups of 4: 0110 1110 Step 2: Convert each group of digits to hex: 6 e

01101110 = 6e

Example 4: Convert the hex number 8f to binary.

Look up each hex digit in the table, and write its binary value.

hex 8 = 1000

hex f = 1111

Therefore, 8f = 10001111

We use hexadecimal to represent numbers because it is:
a) easy to convert hex to binary,
b) easy to convert binary to hex,
c) easier to read 2 digits than 8 digits.

Computer Programming Unit 2.2 - How Hexadecimal Numbers are Used in Computers