Skip to the tool
Binary Translator Free tools

Decimal to hex converter

Convert decimal to hexadecimal: type a decimal number to get it in hex, with the division steps.

Updated · Written and checked by Murugan Vellaichamy

Waiting for input

Prefixes 0b, 0o, 0x and spaces or underscores between digits are fine. A point starts the fraction.

Result
Try:

How to convert decimal to hex

Divide by 16 and note the remainder, which is between 0 and 15. Write remainders 10 to 15 as A to F. Keep dividing the quotient by 16 until it reaches 0, then read the remainders from the bottom up.

DivideQuotientRemainder
419 ÷ 16263
26 ÷ 161A
1 ÷ 1601

Reading the remainders from the bottom up gives 1A3, so 41910 = 1A316.

Common values

DecimalHexWhere you see it
255FFLargest value of one byte
4,095FFFLargest 12-bit value
65,535FFFFLargest 16-bit value
16,777,215FFFFFFWhite in a 24-bit colour, #FFFFFF
2,147,483,6477FFFFFFFLargest signed 32-bit integer
4,294,967,295FFFFFFFFLargest unsigned 32-bit integer

How it’s calculated

Conversions use exact whole-number arithmetic (JavaScript BigInt), so long numbers keep every digit. Fractions are kept as exact ratios; when the digits repeat, the repeating block is found and marked instead of rounded.

Questions

How do I write a negative number in hex?

Programs store it in two’s complement. Tick “Read as signed”, pick the width, and −1 becomes FF in 8 bits or FFFFFFFF in 32 bits.

Why is hex used so much?

One hex digit is exactly four bits, so two hex digits describe one byte. That makes memory addresses, colours and byte dumps much shorter to write than binary.

Can it convert decimals with a fraction?

Yes. 0.5 is 0.8 in hex, because 8/16 = 1/2. Fractions that don’t end in hex are marked as repeating.

More converters

Copied