Decimal to Hex
Convert decimal numbers to hexadecimal (and back), one per line.
Decimal to Hex Converter
Convert decimal numbers to hexadecimal in bulk. Paste one number per line and each line is converted instantly: 255 becomes FF, 4096 becomes 1000, and 3054 becomes BEE. Switch the direction to turn hex back into decimal, or use the swap button to send the result back into the input.
How decimal to hexadecimal conversion works
Hexadecimal is base 16, so each digit stands for a power of sixteen. To convert by hand you divide the decimal number by 16 repeatedly and write down the remainders from last to first. For 3054: 3054 ÷ 16 = 190 remainder 14 (E), 190 ÷ 16 = 11 remainder 14 (E), 11 ÷ 16 = 0 remainder 11 (B). Reading the remainders backwards gives BEE. The converter does the same thing with arbitrary-precision integers, so even 20-digit values come out exactly.
Where you need decimal to hex
- Programming – bit masks, flags, and constants are usually written as
0x…literals. - Colors – every RGB channel from 0 to 255 is a two-digit hex value, e.g. 209 →
D1. - Memory and debugging – addresses, offsets, and error codes such as Windows
0x80070005are hexadecimal. - Networking – MAC addresses, IPv6 groups, and packet dumps all use hex digits.
Options
- Uppercase – choose
FForff. - Prefix – add
0xso the result can be pasted straight into C, Java, JavaScript, or Python. - Pad to full bytes –
Fbecomes0F, handy for byte arrays and color codes. - Group digits – splits long hex numbers into blocks of four for readability.
Decimal fractions are supported too (10.5 → A.8), as are negative numbers (-42 → -2A). To see a value in every base at once, open the All Number Converter; for text rather than numbers, use String to Hex.
Frequently Asked Questions
How do I convert decimal to hex?
Divide the number by 16, note the remainder (10–15 become A–F), and repeat with the quotient until it is 0. The remainders read from last to first are the hex number. With this tool you just paste the numbers – one per line – and copy the result.
What is 255 in hex?
255 in decimal is FF in hexadecimal, the largest value that fits in one byte. 256 is 100 in hex.
Can I convert many numbers at once?
Yes. Put each decimal number on its own line and all of them are converted together. Empty lines are kept, so the output lines up with your input.
Does the converter handle very large numbers?
Yes. It uses BigInt arithmetic, so values beyond 2^53 such as 18446744073709551615 (FFFFFFFFFFFFFFFF) are converted exactly without rounding.