Developer Bases

Decimal to hex

Decimal value
Hexadecimal FF
Divide by 16, keep the remainders
The same number elsewhere
Decimal 255
Binary 11111111
Binary, grouped 1111 1111
Octal 377
Bits needed 8
Note
Divide by 16, read remainders backwards
DecimalBinaryOctalHex
0000
1111
81000108
10101012A
15111117F
16100002010
64100000010040
100110010014464
25511111111377FF
256100000000400100
1024100000000002000400
655351111111111111111177777FFFF
Advertisement
320 × 100

To convert decimal to hexadecimal, divide repeatedly by 16 and read the remainders backwards. 255 gives 15 remainder 15, which is F and F — so FF. Values 10 to 15 are written A to F.

How to convert decimal to hex

1 Enter the decimal number.
2 Read the hexadecimal result.
3 Compare against the binary and octal forms.
4 Prefix with 0x if you are pasting it into code.

The repeated-division method works for any base and is worth understanding rather than memorising. Divide by the target base, note the remainder, divide the quotient again, and continue until the quotient is zero — then read the remainders bottom to top. It is the same procedure whether you are going to base 2, 8, 16 or 36; only the divisor changes.

Questions

FF. It is the maximum value of one byte.

Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING