Decimal to Hex Converter
About this tool
About Decimal to Hex Converter
Enter a decimal number and get its hexadecimal form at once, ready to paste into code, a colour value, a hex editor or a packet definition. Choose uppercase or lowercase letters, and group digits in pairs so each byte stands out. Values of any size convert exactly, from a single byte to a 128-bit number. For negative numbers, the Two's complement panel gives the fixed-width hex that a computer stores, such as FFFFFFD6 for −42 in 32 bits, which is what you need when writing bit masks, reading disassembly or filling a protocol field. Binary, octal and base 36 are shown at the same time, and the custom row covers any base up to 36. All rows can be edited, so if you later have a hex value to decode, type it into the Hexadecimal row and the decimal updates.
Built and maintained by Abhi JainUpdated
How to Convert Decimal to Hex
- 1
Enter the decimal number
Type it into the Decimal row. Commas and spaces are ignored.
- 2
Copy the hex
Copy the Hexadecimal row. For negatives, pick a Bit width in Two's complement and copy the Hex pattern.
Decimal to Hex Converter: questions and answers
How do you convert decimal to hex by hand?
Divide by 16 repeatedly and note the remainders, using A–F for 10–15. Read them from last to first. For 500: 500→31 r4, 31→1 r15 (F), 1→0 r1, so 500 is 1F4.
How do I write a negative number in hex?
Use two's complement at a fixed width: add 2^n to the negative number. −1 in 32 bits is 2^32 − 1 = FFFFFFFF, and −42 is FFFFFFD6.
Why are hex colours written as six digits?
A colour like #FF8800 is three bytes, one each for red, green and blue, from 0 to 255 (00 to FF). Convert each channel's decimal value to two hex digits.
What is 255 in hex?
FF. 256 is 100, which is why byte values stop at FF.
More Number Base Converter presets
Related tools
- Text to BinaryConvert text to binary (8-bit UTF-8 bytes) and binary back to text.
- Text to HexConvert text to hexadecimal UTF-8 bytes or code points, and hex back to text.
- Hash GeneratorMD5, SHA-1, SHA-256, SHA-384 and SHA-512 of any text, with HMAC and expected-hash check.
- Scientific CalculatorFull scientific calculator with trig in degrees or radians, logs, powers, factorials, memory, history and keyboard input.
- Roman Numeral ConverterConvert numbers to Roman numerals and back, with validation and the overline for large numbers.