Decimal to hex converter
To convert decimal to hex, divide the number by 16 again and again and read the remainders from last to first, writing 10 to 15 as A to F. That turns 255 into FF. The converter below does this for any whole number, exactly and with no digit limit, and it runs in your browser.
Converted number
The same integer in your chosen base.
Exact whole-number conversion
Decimal to hex conversion table
| Decimal | Hex |
|---|---|
| 10 | A |
| 15 | F |
| 16 | 10 |
| 25 | 19 |
| 32 | 20 |
| 40 | 28 |
| 64 | 40 |
| 100 | 64 |
| 127 | 7F |
| 128 | 80 |
| 200 | C8 |
| 255 | FF |
| 256 | 100 |
| 1000 | 3E8 |
| 4096 | 1000 |
| 65535 | FFFF |
| 16777215 | FFFFFF |
Watch the rows where the hex digits look like decimal ones. 16 becomes 10, 32 becomes 20 and 100 becomes 64, so never read a hex result as if it were a decimal number. Powers of 16 give a 1 and zeros: 256 is 100 and 4096 is 1000.
The last row, 16777215, is FFFFFF, the largest six-digit hex value. It is also the number of the color white, since each of its three bytes is FF, or 255.
How to convert decimal to hex
Divide the decimal number by 16 and write down the remainder. Divide the quotient by 16 again, and keep going until the quotient is 0. The remainders, read from the last one to the first, are the hex digits. Each remainder is a whole number from 0 to 15, so it always fits in one hex digit.
Take 1000 as an example: 1000 ÷ 16 is 62 remainder 8. 62 ÷ 16 is 3 remainder 14, which is the digit E. 3 ÷ 16 is 0 remainder 3, and reading the remainders backwards gives 3E8.
Another route subtracts powers of 16. 1000 holds three 256s (768), which leaves 232, and 232 holds fourteen 16s (224), leaving 8. The digits are 3, E and 8 again. The converter skips both routes: it builds the exact value and writes it in base 16 in one step, so a number with hundreds of digits converts without rounding.
Using the decimal to hex converter
The page opens on Decimal (10) in From base and Hexadecimal (16) in To base. Type the number in the Number field and select Convert number. The result appears in uppercase in the Converted number panel. Copy result copies it, and Download TXT saves it as number-base-16.txt.
Type the digits only. The converter rejects 1,000 because of the comma, and it rejects a decimal point, so 86.25 gives an error instead of a rounded answer. A leading plus or minus sign is accepted.
The result has no 0x prefix and no leading zeros, so 10 gives A, not 0x0A. Add the prefix or the zeros yourself if your code or color field needs them. Swap bases moves the hex result into the Number field and turns the form into hex to decimal, so you can check it. Reset returns to decimal to hex.
Limits
Negative numbers keep their sign: −255 gives -FF. That is a sign and a magnitude, not the two's complement form a program stores. For a 32-bit two's complement value, add 4294967296 to the negative number first. −1 plus 4294967296 is 4294967295, which converts to FFFFFFFF.
Fractions are out of scope. The converter accepts whole numbers only and rejects input with a decimal point rather than cutting it. The questions below show how to convert a fraction such as 86.25 by hand instead.
Large values are exact. 4294967295 gives FFFFFFFF, and a number far past the 64-bit range still converts digit for digit. Browser memory is the only practical limit, and Cancel stops a conversion that is still running. The page reads numbers only, so it does not turn text or characters into hex codes.
Questions
How do I convert decimal to hex?
Divide by 16, note the remainder, and repeat with the quotient until it reaches 0. Write remainders 10 to 15 as A to F, then read them from last to first. For 200, 200 ÷ 16 is 12 remainder 8, and 12 is C, so 200 is C8 in hex.
What is 10 in hexadecimal?
10 in decimal is A in hexadecimal. Hex needs single digits for the values 10 to 15, so it uses the letters A to F: 11 is B and 15 is F. The next number, 16, is the first two-digit hex value and is written 10.
What is 86.25 in hexadecimal?
86.25 is 56.4 in hexadecimal, but this converter rejects it because it takes whole numbers only. Convert the parts by hand: 86 is 56, and 0.25 × 16 is 4 with nothing left over, so the fraction digit is 4. The converter confirms that 86 gives 56.
Why does hex use letters?
Base 16 needs sixteen digit symbols, one for each value from 0 to 15. The ten decimal digits cover 0 to 9, so A, B, C, D, E and F stand for 10 to 15. Case does not matter on input, and this converter writes results in uppercase.