curly{bits}

curlybits / Base Converter / Decimal to Hex

Decimal to Hex Converter

Type a decimal number to convert it to hex as you type. The working is shown step by step underneath, so you can check your homework or learn the method. Binary, octal and other bases are shown too.

How it's converted

How to use the Decimal to Hex Converter

  1. Type or paste the decimal number into the first box.
  2. Read the hex result in the second box, and click Copy to copy it.
  3. Scroll to How it works for the step-by-step method.

How to convert decimal to hex

Divide the number by 16 and write down the remainder, using A–F for remainders 10 to 15. Keep dividing until you reach 0, then read the remainders from the bottom up.

Example: 255 ÷ 16 = 15 r 15 (F), 15 ÷ 16 = 0 r 15 (F), so 255 = FF. 1000 = 3E8.

For colors, convert each of red, green and blue (0–255) to two hex digits: rgb(255, 128, 0) is #FF8000.

Reference table

DecimalBinaryHexOctal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000810
91001911
101010A12
111011B13
121100C14
131101D15
141110E16
151111F17

Frequently asked questions

What is 100 in hex?

64. 6 × 16 + 4 = 100.

How do I write a negative number in hex?

Tick Signed (two's complement) and pick a bit width: −1 in 32 bits is FFFFFFFF.