Skip to content
Hex Calculator

Decimal to Hex Converter

Convert any decimal number to hexadecimal instantly, with the full repeated-division-by-16 breakdown showing exactly how the result is built.

Hexadecimal result
0xAA

How to Convert Decimal to Hex

Divide the decimal number by 16 and keep the remainder — that's the rightmost hex digit. Take the quotient from that division and divide it by 16 again, keeping that remainder as the next digit to the left. Repeat until the quotient reaches 0, then read the remainders in reverse order.

Each remainder is always between 0 and 15, since you're dividing by 16 — so it always fits in exactly one hex digit, with 10-15 written as A-F.

Decimal to Hex Example, Step by Step

3000 = BB8

3000 (decimal) = BB8 (hex)

3000 / 16 = 187 remainder 8
 187 / 16 =  11 remainder B
  11 / 16 =   0 remainder B

Read bottom to top: B B 8
StepDescriptionResult
Divide 3000 by 16quotient 187, remainder 88
Divide 187 by 16quotient 11, remainder 11 (B)B
Divide 11 by 16quotient 0, remainder 11 (B)B
Read remainders in reverselast remainder firstBB8

The process stops once the quotient hits 0 — that's the same signal decimal long division uses, just with 16 as the divisor instead of 10.

How Many Hex Digits Will I Need?

Each extra hex digit multiplies the range by 16, so you can estimate the digit count before converting anything.

Decimal rangeHex digits neededLargest value
0-151 digitF
16-2552 digitsFF
256-4,0953 digitsFFF
4,096-65,5354 digitsFFFF

Common Mistakes When Converting Decimal to Hex

  • Reading the remainders top to bottom instead of reversing them.
  • Writing a remainder of 10-15 as two digits instead of its single hex letter.
  • Trying to apply this method directly to a negative number instead of using a signed representation.
  • Stopping one division too early, before the quotient actually reaches 0.

Frequently Asked Questions

How do you convert decimal to hex by hand?

Divide the number by 16, write down the remainder, then keep dividing the quotient by 16 until it reaches 0. Reading the remainders from last to first gives the hex value.

Why do you read the remainders backwards?

The first division finds the ones-place digit (16^0), and each division after that finds the next digit up. Since you calculate the smallest place value first but write numbers with the largest place value first, the order has to flip.

What if a remainder is 10 or higher?

Write it as its hex letter instead of two digits — 10 becomes A, 11 becomes B, and so on up to 15 becoming F. A remainder is always 0-15, since you're dividing by 16, so it never needs more than one hex digit.

Can negative decimal numbers be converted this way?

Not directly — this method assumes a non-negative number. Negative values need a signed representation like two's complement at a fixed bit width, which encodes the sign into the bits rather than using a minus sign.

How many hex digits will my decimal number need?

Compare it against powers of 16: under 16 needs 1 digit, under 256 needs 2, under 4096 needs 3, and under 65536 needs 4 — each additional digit multiplies the range by 16.

Is there a faster way than doing it by hand?

Yes — most languages have a built-in conversion, like JavaScript's Number(170).toString(16) or Python's hex(170), both of which return "aa".