Skip to main content
HexConverter

Decimal to Hex Converter

Convert base-10 decimal integers to hexadecimal (base 16) with repeated division remainder tables. Supports negative numbers via two's complement, customizable zero-padding, and arbitrary-precision BigInt arithmetic.

Try samples:
Pad Zeros:
Hexadecimal Result
Swap ⇄
0x2F7
Hex characters: 3•Binary bits: 12•BigInt Division Precision

Repeated Division by 16 Working

Divide continuously by 16. Record remainders, convert them to hex characters (10=A, 11=B, ..., 15=F), and read remainders from bottom to top.

StepDivision OperationQuotientRemainder (Decimal)Hex Digit
1759 ÷ 164777
247 ÷ 16215F
32 ÷ 16022
Read hex digits from bottom row to top row: 2F7
Runs 100% in your browser. Nothing you enter is sent over the network.

The Repeated Division-by-16 Method Explained

Converting from base 10 to base 16 requires successive integer division by 16. In each iteration, the remainder represents one hexadecimal digit (from 0 to 15). Remainders from 10 to 15 are converted to letters A through F:

  • 10 → A
  • 11 → B
  • 12 → C
  • 13 → D
  • 14 → E
  • 15 → F

The process repeats until the quotient reaches 0. Reading the remainders in reverse order (bottom to top) produces the final hexadecimal notation.

For a step-by-step hand calculation tutorial with practice exercises, visit our guide: How to Convert Decimal to Hexadecimal.

Verified Worked Examples

Example 1: Decimal 255 to Hex

Input:255
→
Result:0xFF

Full 1-byte unsigned limit.

255 / 16 = 15 R 15 (F)
15 / 16 = 0 R 15 (F)
Read bottom-up: FF

Example 2: Decimal 1,000 to Hex

Input:1000
→
Result:0x3E8

Standard 3-digit hex representation.

1000 / 16 = 62 R 8
62 / 16 = 3 R 14 (E)
3 / 16 = 0 R 3
Read bottom-up: 3E8

Example 3: Decimal 4,096 to Hex

Input:4096
→
Result:0x1000

Exact power of 16 (16³).

4096 / 16 = 256 R 0
256 / 16 = 16 R 0
16 / 16 = 1 R 0
1 / 16 = 0 R 1
Read bottom-up: 1000

Example 4: Signed Negative (-1 in 8-bit)

Input:-1
→
Result:0xFF

Two's complement for negative numbers.

8-bit capacity = 256
256 - 1 = 255
255 in hex = FF

Example 5: Signed Negative (-2 in 32-bit)

Input:-2
→
Result:0xFFFFFFFE

32-bit word boundary sign extension.

2^32 - 2 = 4,294,967,294
Converted to 32-bit hex: FFFFFFFE

Example 6: Magic Canary (3,735,928,559)

Input:3735928559
→
Result:0xDEADBEEF

Famous debugging constant.

Repeated division through 8 hex digits
Yields DEADBEEF exactly

Frequently Asked Questions

Direct answers to technical and practical questions regarding this tool and base-16 conversion.

How do you convert decimal to hexadecimal by hand?

Divide the decimal integer by 16. Record the quotient and the remainder. If the remainder is between 10 and 15, convert it to its hex letter (10=A, 11=B, ..., 15=F). Continue dividing each new quotient by 16 until the quotient becomes 0. Finally, read the recorded hex remainders from bottom to top to form the hexadecimal number.

Why do we read the division remainders from bottom to top?

Because the first division by 16 extracts the least significant digit (16⁰ = 1s column). Each subsequent division shifts the number to the right by one base-16 place value. The final division calculates the most significant digit (the highest power of 16), so it must be placed at the far left.

How does the converter convert negative decimal numbers like -1 or -128?

Negative integers are converted using two's complement binary arithmetic at a chosen bit width (8, 16, 32, or 64 bits). For example, -1 in 8-bit two's complement is 256 - 1 = 255 (0xFF). In 16-bit it is 65535 (0xFFFF), and in 32-bit it is 0xFFFFFFFF.

What is the hex equivalent of 1000 in decimal?

Decimal 1000 equals hexadecimal 0x3E8. Calculation: 1000 ÷ 16 = 62 with a remainder of 8. Then 62 ÷ 16 = 3 with a remainder of 14 (which is E). Finally 3 ÷ 16 = 0 with a remainder of 3. Reading from bottom to top yields 3, E, 8 → 0x3E8.

What is zero padding in hexadecimal?

Zero padding refers to prepending leading zeros so that the hex number occupies a specific fixed byte length. For instance, in an 8-bit register, the number 15 is padded to two digits as "0x0F". In a 32-bit register, it is padded to eight digits as "0x0000000F".

Does this converter support arbitrarily large numbers?

Yes. Thanks to JavaScript BigInt support, this tool converts integers of thousands of digits without rounding or truncation, unlike older converters that fail beyond 2^53 - 1.

Related Conversion Tools & Resources

Explore companion converters, bitwise arithmetic calculators, and reference charts.

Sources & Technical References

Technical Verification & Editorial Accountability

Written by Sarah Chen (Embedded Systems Engineer) • Verified by Marcus Brody, PE

Reviewed: 2026-10-02MethodologyEditorial PolicyReport Error