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.
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.
| Step | Division Operation | Quotient | Remainder (Decimal) | Hex Digit |
|---|---|---|---|---|
| 1 | 759 ÷ 16 | 47 | 7 | 7 |
| 2 | 47 ÷ 16 | 2 | 15 | F |
| 3 | 2 ÷ 16 | 0 | 2 | 2 |
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
Full 1-byte unsigned limit.
Example 2: Decimal 1,000 to Hex
Standard 3-digit hex representation.
Example 3: Decimal 4,096 to Hex
Exact power of 16 (16³).
Example 4: Signed Negative (-1 in 8-bit)
Two's complement for negative numbers.
Example 5: Signed Negative (-2 in 32-bit)
32-bit word boundary sign extension.
Example 6: Magic Canary (3,735,928,559)
Famous debugging constant.
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.
Hex to Decimal Converter
Convert hexadecimal to decimal instantly with digit-by-digit positional steps. Supports 0x prefixes, signed two's complement, and BigInt precision.
Hex to Binary Converter
Convert hexadecimal digits into 4-bit binary nibbles. Features visual nibble breakdown, customizable grouping, and leading zero toggles.
Hexadecimal Conversion Chart (0–255)
Complete 0 to 255 hexadecimal lookup chart with decimal, 8-bit binary, octal, and ASCII character equivalents. Filterable and copyable table.
How to Convert Decimal to Hexadecimal
Master manual decimal-to-hexadecimal conversion using repeated division by 16 and remainders. Worked steps, practice problems, and explanations.
Sources & Technical References
- [1]Donald Knuth: The Art of Computer Programming, Vol 2 (Seminumerical Algorithms) — Addison-Wesley
Classical algorithmic formulation for radix base conversion via repeated Euclidean division.
- [2]MDN Web Docs: Number.prototype.toString(radix) — Mozilla Developer Network
Specification for radix string representation and base conversion.
Technical Verification & Editorial Accountability
Written by Sarah Chen (Embedded Systems Engineer) • Verified by Marcus Brody, PE