Decimal to Hex Converter

Enter a decimal number to get its hexadecimal form, with the repeated division by 16 worked out below.

Loading tool…

About the Decimal to Hex

To convert a decimal number to hexadecimal, divide it by 16 repeatedly and keep each remainder. Remainders 10–15 become the letters A–F. Read the remainders from the last one to the first. For 3054: 3054 ÷ 16 = 190 remainder 14 (E), 190 ÷ 16 = 11 remainder 14 (E), 11 ÷ 16 = 0 remainder 11 (B), so 3054 = 0xBEE. The working table under the result shows the same steps for your number.

Hex output is padded to whole bytes in the “Bytes” line (0B EE) so you can compare it with a hex dump or a network capture. Remember that the byte order in memory depends on endianness: 3054 stored as a little-endian 16-bit integer appears as EE 0B in a dump, while the number itself is still 0x0BEE.

Typical uses: writing a colour channel (200 → C8), setting a flag or bit mask in code, building a Unicode escape (\u00E9 for 233), or reading error codes such as Windows HRESULTs, which are documented in hex. Large values like 64-bit IDs convert exactly because the tool uses BigInt. Negative numbers are shown with a minus sign; their two's complement hex form is in the number base converter.

How to use it

  1. Type a whole decimal number.
  2. Read the hexadecimal result (upper case) and its byte grouping.
  3. Follow the divide-by-16 table to see how each hex digit is produced.
  4. Copy the result; add a 0x prefix if your language needs one.

Frequently asked questions

How do you convert decimal to hexadecimal?
Divide by 16, note the remainder (10–15 → A–F), repeat with the quotient until it is 0, then read the remainders in reverse. 255 → 15 r15 → 0 r15, so 255 = FF.
What is 255 in hex?
FF.
What is 1000 in hex?
3E8 (3×256 + 14×16 + 8).
How do I convert a number to hex in code?
JavaScript: (3054).toString(16). Python: hex(3054) gives '0xbee', or format(3054, 'X') for 'BEE'. C: printf("%X", n). Java: Integer.toHexString(n).

Related tools