FormatterHQ

Decimal to Hexadecimal Converter

Turn decimal numbers into hexadecimal in one step. Type or paste a value, choose upper or lower case letters, and copy the result for code, colors or documentation.

Loading tool…
Ready.

How to use the Decimal to Hexadecimal Converter

  1. Type the decimal number you want to convert in the Decimal field.
  2. Tick or clear Uppercase letters to choose whether A–F are upper case or lower case.
  3. Read the hexadecimal value in the Hexadecimal field, which updates as you type.
  4. Copy the result and add a prefix such as 0x or # if your code needs one.

Decimal to hex conversion in one step

This decimal to hex converter rewrites base-10 numbers in hexadecimal (base 16), the compact notation programmers use for bytes, memory addresses, colors and character codes. You can convert integers far larger than 64 bits and values with a fractional part, and the result updates as you type.

What is hexadecimal?

Hexadecimal needs sixteen digits, so after 0–9 it borrows the letters A–F for the values 10 to 15. Each position is worth sixteen times the one to its right.

PositionValue
16^01
16^116
16^2256
16^34,096
16^465,536

Because 16 is 2^4, every hex digit stands for exactly four bits. Two hex digits describe one byte, which is why a byte ranges from 00 to FF (0 to 255).

How to convert decimal to hex by hand

Divide the number by 16, note the remainder, and repeat with the quotient until it reaches zero. Write the remainders as hex digits and read them from the last to the first.

48879 ÷ 16 = 3054   remainder 15 → F
 3054 ÷ 16 = 190    remainder 14 → E
  190 ÷ 16 = 11     remainder 14 → E
   11 ÷ 16 = 0      remainder 11 → B
Read from the bottom up: 48879 = BEEF

A second route goes through binary: 255 is 1111 1111, and each group of four bits maps to one hex digit, giving FF. For small numbers the binary route is often faster in your head.

Fractions

For the part after the decimal point, multiply by 16 and take the whole-number part as the next digit. 0.75 × 16 = 12, which is C, so 3.75 becomes 3.C, and 0.5 × 16 = 8 gives 0.8. Fractions such as 0.1 repeat forever in base 16 (0.1999…), so the tool stops after 20 hex places.

Example

Input          Output
10             A
255            FF
4096           1000
3735928559     DEADBEEF
3.75           3.C
-255           -FF

Options and input rules

  • Letter case: choose upper case (FF) or lower case (ff). The value is identical; the choice only matters for style guides, CSS conventions or byte-for-byte comparisons.
  • No prefix is added: the result is the bare digits. Add 0x for C, JavaScript, Python or Java literals, or # for CSS colors.
  • Big integers are exact: 18446744073709551615 converts to FFFFFFFFFFFFFFFF with no rounding, because the tool does not rely on floating-point numbers.
  • Negatives keep a minus sign: -255 becomes -FF. If you need the 32-bit two's complement form (FFFFFF01), use the bitwise calculator, which shows fixed-width results.
  • Separators: spaces, commas, underscores and apostrophes are ignored as digit grouping, so 1,000,000 and 1_000_000 both read as one million. The field holds one number at a time.

Where you will use decimal to hex

  • Colors: an RGB color of 255, 136, 0 becomes FF, 88 and 00, or #FF8800. The HEX to RGB converter handles whole colors in both directions.
  • Character codes: Unicode code points are written in hex, so é (233) is U+00E9. To encode whole strings, use string to hex.
  • Memory and file offsets: debuggers, hex editors and crash logs show addresses in hex.
  • Constants and flags: masks such as 0xFF00 are easier to read in hex than as 65280.

Common mistakes

  • Forgetting to pad bytes to two digits. Decimal 10 is A, but in a color or a byte string it must be written 0A.
  • Reading "10" in hex as ten. It is sixteen; use the hex to decimal converter to check a value you are unsure about.
  • Writing the remainders in the order you calculated them instead of reversing them.

Frequently asked questions

What is 255 in hex?
255 is FF in hexadecimal. It is the largest value of a single byte, so you see it in color codes such as #FFFFFF (white) and in masks such as 0xFF.
Should hex letters be upper case or lower case?
Both mean the same value, and virtually every parser accepts either. Pick the style your project already uses; CSS and many web style guides favor lower case, while hardware documentation often uses upper case.
Why does 0.1 give such a long hex result?
0.1 has no finite representation in base 16, just as 1/3 has none in decimal. The digits 9 repeat forever, so the converter shows the first 20 hex places and stops.
How do I convert a negative number to hex two's complement?
Choose a width and add 2 to that power. In 32 bits, -255 is 4,294,967,296 − 255 = 4,294,967,041, which is FFFFFF01. The bitwise calculator shows this form automatically when you enter a negative number.
Can I convert several numbers at once?
No, the converter works on one number at a time and updates as you type, so replace the value to convert the next one. Each number is also shown in binary, octal and a custom base at the same time.

Last updated October 3, 2026

Related tools