Skip to content
BetterDL

Hex–decimal conversion

Also called: hex to decimal, decimal to hex, hexadecimal to decimal, decimal to hexadecimal

Converting between hexadecimal and decimal: multiply each hex digit by its power of 16 and add, or divide by 16 repeatedly to go the other way.

Hex → decimal: multiply each digit by its weight and add. Hex weights are powers of 16: 1, 16, 256, 4096, 65,536. Remember that A–F stand for 10–15.

Decimal → hex: use repeated division by 16. Each remainder, 0 to 15, is one hex digit, starting from the right. Write remainders of 10–15 as A–F.

An alternative that's sometimes easier by hand is to go through binary: convert decimal to binary, then group into nibbles (binary hex conversion). For hex → decimal, the direct method is usually fastest.

Two checks that catch most errors:

  • A hex number with no letters still isn't decimal: 36₁₆ = 3 × 16 + 6 = 54.
  • Two hex digits never exceed FF₁₆ = 255, and three never exceed FFF₁₆ = 4095. If your answer is bigger, something went wrong.
1
16²
A
16¹
3
16⁰

Worked examples

Example

1A3₁₆ to decimal and back

Digit × weight one way, repeated division the other.

  1. 1.

    1 × 256 + 10 × 16 + 3 × 1 = 256 + 160 + 3 = 419.

  2. 2.

    Back: 419 ÷ 16 = 26 remainder 3.

  3. 3.

    26 ÷ 16 = 1 remainder 10, written A.

  4. 4.

    1 ÷ 16 = 0 remainder 1.

  5. 5.

    Read last to first: 1A3₁₆. The round trip agrees.

Example

3054₁₀ to hex

Three divisions by 16.

  1. 1.

    3054 ÷ 16 = 190 remainder 14 → E.

  2. 2.

    190 ÷ 16 = 11 remainder 14 → E.

  3. 3.

    11 ÷ 16 = 0 remainder 11 → B.

  4. 4.

    Result: BEE₁₆. Check: 11 × 256 + 14 × 16 + 14 = 2816 + 224 + 14 = 3054.

Common mistakes

  • Reading a hex number as if it were decimal.

  • Writing a remainder of 14 as "14" instead of the single digit E.

  • Using powers of 10 or 8 as the weights by mistake.

Practice Hex–decimal conversion

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Hex–decimal conversion is taught in Number Systems.