Skip to content

Decimal to Hex Converter

Type a decimal number and get the hex value as you type, with binary and the stored form of negative numbers. Paste a list to convert many at once. Switch direction to go from hex to decimal.

3000 ÷ 16 → remainders 8, 11, 11 → BB8

Commas like 1,000,000 are fine. Separate several numbers with spaces or new lines.

Hex
BB8
Binary
101110111000

How to Convert Decimal to Hex

Hex counts in sixteens, using 0–9 and then A–F for ten to fifteen. The standard way to convert is to keep dividing by 16 and collect the remainders:

  1. Divide the number by 16. Write down the whole-number answer and the remainder.
  2. Divide that answer by 16 again, and keep going until the answer is 0.
  3. Turn each remainder into a hex digit: 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F.
  4. Read the remainders from the last one to the first. That's the hex number.

On a calculator, the remainder is the part after the point times 16: 3000 ÷ 16 = 187.5, and 0.5 × 16 = 8.

number ÷ 16 = answer, remainder → next hex digit (written right to left)

Worked Example: 3000 to Hex

Convert 3000 to hexadecimal.

Step 1: Divide 3000 by 16

3000 ÷ 16 = 187, remainder 8

Step 2: Divide 187 by 16

187 ÷ 16 = 11, remainder 11 → B

Step 3: Divide 11 by 16

11 ÷ 16 = 0, remainder 11 → B

Step 4: Read the remainders from the bottom up

B B 8 → BB8

Result: 3000 in decimal = BB8 in hex. Check it backwards: 11 × 256 + 11 × 16 + 8 = 2,816 + 176 + 8 = 3,000.

Decimal to Hex Chart

Everyday numbers and their hex values. Notice where a new digit appears: 16 becomes 10, 256 becomes 100 and 4,096 becomes 1000.

Common decimal numbers converted to hex
DecimalHex
11
22
99
10A
11B
12C
13D
14E
15F
1610
1711
2014
3220
5032
6440
10064
1277F
12880
200C8
255FF
256100
5001F4
1,0003E8
1,024400
2,048800
4,0961000
10,0002710
65,535FFFF
65,53610000
1,000,000F4240

Common Mistakes

Common decimal to hex mistakes
MistakeWrongRight
Reading the remainders top to bottom8BBBB8
Writing a remainder of 11 as "11" instead of B11118BB8
Dropping a remainder of 0 (256 ÷ 16 = 16 r 0, 16 ÷ 16 = 1 r 0)1100
Using the decimal part as the remainder (187.5 → 5)BB5BB8

For color codes, convert each of the red, green and blue values separately and pad each to two digits: 200, 100, 50 becomes C8 64 32, or #C86432. The RGB to HEX converter does this in one step.

Negative Numbers in Hex

On paper, −255 in hex is simply −FF. Computers don't store a minus sign, though. They count back from the top of a fixed size, so −1 is stored as FF in one byte, FFFF in two bytes and so on. This is called two's complement. When you enter a negative number, the tool shows both: the plain answer and the stored form at the smallest common size that fits.

Negative decimal numbers and how they are stored in hex
DecimalWrittenStored (two's complement)
−1−1FF (8 bits)
−5−5FB (8 bits)
−128−8080 (8 bits)
−255−FFFF01 (16 bits)
−40,000−9C40FFFF63C0 (32 bits)

Decimal to Hex in Excel, Python and JavaScript

Converting decimal to hex in common tools
ToolHowResult for 3000
Excel or Google Sheets=DEC2HEX(3000)BB8
Excel (padded to 4 digits)=DEC2HEX(3000, 4)0BB8
Pythonformat(3000, "X")BB8
JavaScript(3000).toString(16).toUpperCase()BB8
Windows CalculatorProgrammer mode → DEC → type 3000 → read HEXBB8

Python's hex(3000) also works but adds 0x and uses lowercase (0xbb8). For negative numbers, Excel's DEC2HEX returns the 10-digit stored form, so =DEC2HEX(-1) gives FFFFFFFFFF.

Frequently asked questions

What is 255 in hex?

FF. 255 ÷ 16 = 15 remainder 15, and 15 is F, so both digits are F. It is the largest number that fits in two hex digits.

What is 10 in hex?

A. Hex uses the letters A to F for the values ten to fifteen, so 10 is A and 15 is F. 16 is written 10 in hex.

How do I always get two digits, like 0A instead of A?

Add a 0 in front of any single-digit answer. In Excel use =DEC2HEX(10, 2), and in Python format(10, "02X").

Can I convert a number with a decimal point?

This tool works with whole numbers. Fractions in hex are rare outside computer science courses, and most decimal fractions never end in hex.

Sources