0xCONVERTER-HEX

Tutorial

How to Convert Decimal to Hex by Hand

Divide by sixteen, collect the remainders, read them backwards.

Why practise by hand

The converters on this site will always be faster. The point of working through it manually is that afterwards you can read a hex value without a tool at all — which is what you need when you are looking at a stack trace or a datasheet rather than a browser tab.

The method

  1. Divide your number by 16. Write down the whole-number quotient and the remainder.
  2. Convert the remainder to a hex digit: 10 is A, 11 is B, 12 is C, 13 is D, 14 is E, 15 is F.
  3. Divide the quotient by 16 and record the next remainder.
  4. Repeat until the quotient reaches 0.
  5. Read the remainders from the last one back to the first. That is your answer.
The step everyone gets wrong

Read the remainders upwards. The first remainder you calculate is the ones digit, so it belongs at the end of the answer. Reading them in the order you produced them gives you the digits reversed.

Worked example: 6699

  6699 ÷ 16 = 418  remainder 11  → B
   418 ÷ 16 =  26  remainder  2  → 2
    26 ÷ 16 =   1  remainder 10  → A
     1 ÷ 16 =   0  remainder  1  → 1

  read upwards  →  1A2B

  check: 1×4096 + 10×256 + 2×16 + 11 = 6699  ✓

Worked example: 47

    47 ÷ 16 =   2  remainder 15  → F
     2 ÷ 16 =   0  remainder  2  → 2

  read upwards  →  2F

The shortcut for anything under 256

Values below 256 fit in one byte and need only one division. The quotient is the first digit, the remainder is the second.

200  →  200 ÷ 16 = 12 remainder  8  → C8
 47  →   47 ÷ 16 =  2 remainder 15  → 2F
255  →  255 ÷ 16 = 15 remainder 15  → FF
128  →  128 ÷ 16 =  8 remainder  0  → 80

Both digits still need converting to letters where they exceed 9, and the remainder must be written even when it is zero — 80, not 8.

An alternative: subtract the place values

Some people find this easier than dividing. Work out how many of each place value fit, largest first.

6699 using place values

  how many 4096s? 1     → digit 1,  6699 - 4096 = 2603
  how many  256s? 10    → digit A,  2603 - 2560 =   43
  how many   16s? 2     → digit 2,    43 -   32 =   11
  how many    1s? 11    → digit B

  result → 1A2B

This produces the digits in reading order, which avoids the reversal mistake entirely. It needs the powers of sixteen to hand: 1, 16, 256, 4096, 65536.

Practice problems

  1. 31
  2. 160
  3. 255
  4. 256
  5. 683
  6. 4095
1.  31   →  31 ÷ 16 = 1 r 15                        → 1F
2.  160  → 160 ÷ 16 = 10 r 0                        → A0
3.  255  → 255 ÷ 16 = 15 r 15                       → FF
4.  256  → 256 ÷ 16 = 16 r 0; 16 ÷ 16 = 1 r 0     → 100
5.  683  → 683 ÷ 16 = 42 r 11; 42 ÷ 16 = 2 r 10   → 2AB
6.  4095 → three divisions, all remainder 15               → FFF

Common mistakes

  • Reading remainders downwards. The most common error by a wide margin.
  • Leaving a remainder as a number above 9. Eleven is B, not 11.
  • Stopping too early. Keep dividing until the quotient is genuinely 0, not 1.
  • Dropping a zero remainder. A remainder of 0 is a real digit and must be written.

Check your work

Convert your answer back with the hex to decimal method, or use the decimal to hex converter to confirm.

Frequently asked questions

How do I convert decimal to hex manually?

Divide by 16 repeatedly, writing down each remainder, until the quotient is zero. Then read the remainders from the last back to the first.

Why do I read the remainders backwards?

The first remainder is the ones digit, so it belongs at the end of the answer. Reading them in calculation order reverses the number.

What is the shortcut for numbers under 256?

One division. The quotient is the first hex digit and the remainder is the second. 200 gives 12 remainder 8, which is C8.

Is there a method that avoids reversing?

Yes. Subtract place values largest first: how many 4096s, then 256s, then 16s, then 1s. The digits come out in reading order.

What is 255 in hex?

FF. 255 divided by 16 is 15 remainder 15, and 15 is F.

When do I stop dividing?

When the quotient is zero, not when it is one. Stopping at one loses the leading digit.