Loading...
Loading...
Enter decimal integers and get hexadecimal output instantly. Supports batch conversion - one value per line.
Base-10 decimal number
Hexadecimal (base-16)
Decimal (base-10) uses the digits 0 through 9. Hexadecimal (base-16) uses those same digits plus the letters A through F to represent values 10 through 15. This gives 16 unique symbols per digit position. The digit A means 10, B means 11, C means 12, D means 13, E means 14, and F means 15.
To convert decimal to hex by hand, you use repeated division by 16. Divide the number by 16, record the remainder as the rightmost hex digit, then divide the quotient again, repeating until the quotient is zero. For example, 255 divided by 16 is 15 remainder 15. 15 divided by 16 is 0 remainder 15. Reading the remainders bottom to top and substituting F for 15 gives FF. So 255 in decimal is FF in hex.
The tool above performs this conversion for any positive integer. Results appear in uppercase without a 0x prefix, making them ready to paste into CSS, assembly, or data files.
CSS colors in hex format (#RRGGBB) require each color channel - red, green, and blue - to be expressed as a two-digit hex number. Each channel ranges from 0 to 255 in decimal. If your design tool gives you RGB values as decimals, you need to convert each channel separately: rgb(255, 128, 0) becomes #FF8000 because 255 = FF, 128 = 80, and 0 = 00.
Paste all three channel values at once, one per line, and copy each two-digit hex result into your stylesheet. If a result is only one digit (for values 0-15), pad it with a leading zero to get the required two-character format.
The same approach applies to opacity values in 8-digit hex colors (#RRGGBBAA). An alpha value of 128 in decimal converts to 80 in hex, giving an opacity of approximately 50 percent.
Debuggers and profiling tools display memory addresses in hex because a 32-bit address is 8 hex digits - concise and unambiguous. If a crash report or stack trace gives you an address in decimal, converting it to hex lets you match it against what the debugger shows.
HTTP status codes, Windows error codes (HRESULT), and Unicode code points are all commonly expressed in hex. If documentation gives a decimal value and you need the hex form to match against a constant in your code, paste the decimal here and get the hex equivalent immediately.
Does the output include a 0x prefix?
No. The converter outputs plain uppercase hex digits. Add 0x manually if you need it for source code, or # if you are building a CSS color string.
Can I convert negative decimal numbers?
Negative numbers in hex depend on the representation used (sign-magnitude, one's complement, or two's complement) and the bit width. This tool converts the absolute value. For two's complement negative numbers, use the bit-width-specific formula separately.
Is the output always uppercase?
Yes, by default. CSS and HTML accept both cases for color values, but many programming conventions and style guides prefer uppercase hex. Both 0xFF and 0xff represent the same value.