Every network engineer must know how to convert decimal to hex and hex to decimal.

## Decimal to Hexadecimal conversion

To learn how to convert a decimal number to its hexadecimal format, let’s take an example.

Suppose we want to convert 39619 into Hex.

- We take 39619 and divide it by 16: 39619/16 = 2476.1875. We note the remainder of the division (aka the Modulo). 39619 mod 16 =
**3**. - We take 2476. We divide it by 16: 2476/16 = 154.75. We note the remainder of the division: 2476 mod 16 =
**12** - We take 154 and divide it by 16: 154/16 = 9.625. We note the remainder of the division: 154 mod 16 =
**10** - We take 9 and divide it by 16: 9/16 = 0. We note the remainder of the division: 9 mod 16 =
**9** - We stop because we encountered a 0 in step 4.
- Now we read the series of modulos we found in steps 1 to 4, in the reverse order:
**9 10 12 3** - We convert each modulo of the sequence to its hex format:
- This gives us
**9AC3**which is the hexadecimal format of**3619**.

## Hexadecimal to Decimal conversion

Here are the steps to convert a hexadecimal string to decimal:

- Take each hex character apart
- Convert each hex character to its decimal value
- Multiply each decimal value by the corresponding hex position, in the whole hex string.

Let’s take an example. We want to convert the hex string AE0D to its decimal value. By the way, you must learn this table by heart:

Back to our example. We begin by taking each hex character apart and convert it to its decimal value. We get the following table:

Now we determine the hex position of each hex character:

We multiply each decimal value by the corresponding hex position:

Last, we do the sum total:

So, AE0D (in hexadecimal) = 44557 (in decimal)