Skip to content
Devtoolry

Decimal to Hex Converter

Convert decimal to hexadecimal online with the division by 16 shown step by step. Choose uppercase, a 0x prefix and a bit width for negative numbers.

Runs in your browser · Nothing uploaded · No sign-up

Something not working, or missing a feature? Send feedback

About the Decimal to Hex Converter

The Decimal to Hex Converter writes decimal numbers in hexadecimal by dividing by 16 and reading the remainders upwards, with every step shown. Pick upper or lower case, add a 0x prefix, and choose a bit width to pad the result or to write negative numbers in two's complement, as in C and assembly.

Conversion happens in your browser, so your files and records stay private.

How to use the Decimal to Hex Converter

  1. Type a decimal number such as 255, or paste one per line.
  2. Choose uppercase or lowercase digits and whether to add the 0x prefix.
  3. Select a bit width (8, 16, 32 or 64) to pad with zeros or to convert negative numbers.
  4. Read the hex result and the division-by-16 table, then copy it.

Common values in hex

DecimalHexWhat it is
255FFLargest byte value
256100Number of values in a byte
1,0244001 KiB
4,095FFFLargest 12-bit value
65,535FFFFLargest 16-bit unsigned value
2,147,483,6477FFFFFFFLargest signed 32-bit integer
4,294,967,295FFFFFFFFLargest unsigned 32-bit integer

Examples

One byte

Input

255

Result

FF
A famous constant

Input

3735928559

Result

DEADBEEF
−1 as a 32-bit integer

Input

-1 (Bit width 32-bit)

Result

FFFFFFFF
One million

Input

1000000

Result

F4240

Common mistakes

  • Writing a remainder of 10–15 as two digits. A remainder of 12 is the single digit C, not "12". Each remainder becomes exactly one hex digit.
  • Values that do not fit the width. 256 does not fit in 8 bits. The converter shows the allowed range instead of silently cutting off the high bits.

Works well with the Decimal to Hex Converter

Frequently asked questions

How do you convert decimal to hex?

Divide by 16 and note the remainder (0–15, with 10–15 written A–F). Repeat with the quotient until it is 0, then read the remainders from the last to the first. 255 ÷ 16 = 15 r15, 15 ÷ 16 = 0 r15, so 255 is FF.

What is −1 in hex?

It depends on the width: FF in 8 bits, FFFF in 16, FFFFFFFF in 32 and FFFFFFFFFFFFFFFF in 64. Choose the width to get the two's complement pattern.

Uppercase or lowercase?

Both are correct. Uppercase is common in documentation and dumps, lowercase in CSS colours and most programming languages' output. The value is the same.

Why do programmers use hex?

Each hex digit is exactly 4 bits, so a byte is two digits and a 32-bit value is eight. Addresses, colours, hashes and bit masks are much easier to read in hex than in decimal or binary.