Decimal to Hex Converter – Free, Online, Private
Convert a whole number to hexadecimal. The result is prefixed with 0x and uses uppercase digits. Negative numbers keep the minus sign.
How to convert Decimal to Hex
- Enter a base-10 integer. A leading minus is allowed. Do not include commas.
- The page prints 0x and the uppercase hex digits.
- Copy it into source code. The number base tool covers binary and octal if you need them.
Format
255 becomes 0xFF. 0 becomes 0x0. 16 becomes 0x10. Letters are uppercase so the token matches the way many dumps and RFCs print hex. The 0x prefix is always there, including for zero, so the radix is obvious when you paste the token into a comment. A negative input keeps a leading minus and then 0x, so -255 is -0xFF. That is a signed decimal rendered in hex, not a two's complement bit pattern. Commas, underscores, spaces and a trailing decimal point are rejected. 255.0 is not an integer. Write 255.
Size
The conversion uses BigInt, so a 40-digit integer stays exact. JavaScript's Number would have rounded it. A leading plus is not accepted; a leading minus is. Hex input is not accepted on this page: FF without a decimal interpretation is the hex-to-RGB page's job when it is a color, and the number base tool's job when it is a general radix conversion. This page answers the decimal question only, which keeps a stray letter from silently changing the base.
Worked example
The sample 255 is 0xFF, the byte of all bits set, which is also 11111111 on the binary page. 256 is 0x100. 4095 is 0xFFF. A color channel you got as a decimal from a canvas ImageData array can be checked here, then passed to the RGB to hex page if you have all three channels. One channel alone is not a color. Large ids, such as a 64-bit decimal from a log, convert without rounding, which you can verify by counting the hex digits: 16 hex digits cover 64 bits.
Local arithmetic
The digits never leave the browser. There is nothing to upload. Use the timestamp pages when the number is a time, and the color pages when it is a channel. The prefix is part of the copy so you do not have to remember which base the bare digits were.
Frequently asked questions
What is 255 in hex?
0xFF. The letters are uppercase and the prefix is included.
Are fractions allowed?
No. Enter a whole number. 255.0 is rejected.
How are negatives shown?
With a leading minus, then 0x. -255 is -0xFF, not a two's complement pattern.
Is the number uploaded?
No.