Introduction to Hexadecimal Numbers

concept
Hexadecimal numbers are a base 16 number system and are incredibly popular these days. The rules for using hex numbers and converting between them and other systems is very similar to what we've already seen for binary and octal so there won't be much new here. The only real place you might get tripped up is the introduction of some letters as digits. Since hexadecimal is a base 16 system we obviously need symbols for handling the digits for "10", "11", "14" etc. To accomplish this we use the capital letters A-F to represent the digits "10"-"15".
fact
Hexadecimal is a base 16 number system, each digit can have one of 16 values from \(0_{10}\) to \(15_{10}\). To represent the digits for numbers greater than 9 we use the letters A-F as shown in the table below:
DecimalHexadecimal
00
11
22
99
10A
11B
12C
13D
14E
15F
1611
1712
fact
As a base 16 number system the place values for hexadecimal digits are given by \(16^n\) where \(n\) is the number of digits from the right and starts at 0. The first 4 place digits are:
Place3210
Value4096256161
Converting a hex number into decimal follows the exact same process that binary and octal did. Just multiply each digit by its place value and sum.
fact
To convert a hexadecimal number into binary multiply each digit's value by its place value and sum to get the result.
example

Convert \(2A_{16}\) into decimal.

$$2_{16} = 2_{10}$$ And $$A_{16} = 10_{10}$$ So: $$2A_{16} = 2\times 16 + 10\times 1 = 42_{10}$$
example

Convert \(C2_{16}\) into decimal.

$$C_{16} = 12_{10}$$ And $$2_{16} = 2_{10}$$ So: $$C2_{16} = 12\times 16 + 2\times 1 = 194_{10}$$
Converting a decimal number into hexadecimal is also the same as converting binary or octal into hexadecimal. We use the SOAR table and the same method but we divide by 16 since we're converting to a base 16 number system.
fact
To convert a decimal number into hexadecimal use a SOAR table. SOAR stands for: Step Operation Answer Result The steps are:
  1. Divide your decimal number by 16
  2. Write the integer part of the answer under the "Answer" column
  3. Write the remaineder part of the answer under the "Remainder" column
  4. Repeat step 1 with the integer part of your answer until \(A=0\)
  5. The hexadecimal number is the digits in the "Remainder" column read bottom up
example

Convert \(122_{10}\) to hexadecimal.

We start by drawing up our SOAR table:
SOAR
1
Now step 1 we write \(\frac{122}{16}\) into the Operation column which gives us 7 remainder 10. We write the remainder in hexadecimal so we write 7 under the Answer column and A under the Remainder column.
SOAR
1\(\frac{122}{16}\)7A
Now our number is A (or 10) so we move onto step 2 and write \(\frac{7}{16}\) for our Operation.
SOAR
1\(\frac{122}{16}\)7A
2\(\frac{7}{16}\)
This division gives us 0 Remainder 7.
SOAR
1\(\frac{122}{16}\)7A
2\(\frac{7}{16}\)07
And we're done. The hexadecimal number is read from the bottom up and is: $$122_{10} = 7A_{16}$$
fact
To convert hexadecimal to binary write each hex digit as a 4-bit binary number.
example

Convert \(28_{16}\) to binary.

$$\begin{align} 2\phantom{00} & \phantom{00}8 \\ 0010\; & \; 1000 \\ \end{align}$$ So we can see that: $$28_{16} = 00101000_2$$
example

Convert \(2B6_{16}\) to binary

$$\begin{align} 2 \quad\; B& \quad\;\;\;\; 6 \\ 2 \quad\;\; 1&1\quad\;\; 6 & \\ 0010\; 10&11\; 0110 \\ \end{align}$$ So we can see that: $$2B6_{16} = 001010110110_2$$
fact
To convert from binary to hexadecimal group the binary digits in groups of 4 starting from the right and convert each 4-bit binary number into its hexadecimal value.
example

Convert \(110100100_2\) to hexadecimal

We group our number as shown: $$0001\;\;1010\;\;0100$$ Where we've added leading 0s to make up a total of 4 digits for the left-most group. Now we'll convert each of these groups into their decimal value (this step isn't necessary it just makes things a little smoother). $$\begin{align} 0001\;\;10&10\;\;0100 \\ 1\quad\;\;1&0\quad\;\;4 \\ \end{align}$$ And then we convert each of these decimal numbers into their hexadecimal form: $$\begin{align} (0&001\;\;1010\;\;0100)_2 \\ & (1\quad\;\;10\quad\;\;\;4)_{10} \\ & (1\quad\;\;A \quad\;\;\;\;4)_{16} \\ \end{align}$$ $$\text{So:}\quad 110100100_2 = 1A4_{16}$$
fact
To convert from hexadecimal to octal or from octal to hexadecimal first convert to binary and then to your desired base.
practice problems