Tools
Log in
English

All converters

Decimal to hex

Convert decimal numbers to hex. Negatives can show as 8 to 64-bit patterns.

Result

Hex
Decimal
Binary
Octal

Settings

To convert decimal to hex, keep dividing by 16 and read the remainders from the last one back to the first. Enter a whole number like 255 or 48879 and the hex form is ready to copy, in upper or lower case, with or without 0x and leading zeros. No sign-up and no cost.

How to do it by hand

  1. Divide the number by 16 and note the whole quotient and the remainder.
  2. Write remainders 10 to 15 as the letters A to F.
  3. Divide the quotient by 16 again, and repeat until it reaches 0.
  4. Read the remainders from the last one to the first. That string is the hex value.

Worked examples

200

200 ÷ 16 = 12 r 8, 12 ÷ 16 = 0 r 12 (C)

C8

4660

4660 ÷ 16 = 291 r 4, 291 ÷ 16 = 18 r 3, 18 ÷ 16 = 1 r 2, 1 ÷ 16 = 0 r 1

1234

48879

48879 ÷ 16 = 3054 r 15 (F), 3054 ÷ 16 = 190 r 14 (E), 190 ÷ 16 = 11 r 14 (E), 11 ÷ 16 = 0 r 11 (B)

BEEF

Common mistakes

  • Reading the remainders top to bottom. The first remainder you get is the last digit.
  • Writing a remainder like 12 as two characters. Each remainder is one hex digit, so 12 is C.
  • Expecting a plain minus sign inside programs. Code usually stores -16 as F0 in 8 bits or FFF0 in 16 bits.

Common decimal values in hex

DecimalHexBinary
10A1010
15F1111
161010000
3220100000
64401000000
100641100100
1277F1111111
1288010000000
200C811001000
255FF11111111
256100100000000
1,0003E81111101000
1,02440010000000000
4,095FFF111111111111
4,09610001000000000000
65,535FFFF1111111111111111
65,5361000010000000000000000

Questions people ask

How do I get FF for 255 instead of ff?

Pick upper case in the options. Lower case is there as well if your code style needs it.

Why does -1 come out as FFFFFFFF?

That is -1 written as a 32-bit two's complement. Choose 8, 16 or 64 bits to see FF, FFFF or sixteen Fs.

Can I convert a number with a decimal point?

Yes, in the fraction mode. 0.5 becomes 0.8 in hex, and digits that never stop are shown with a repeat mark.