Decimal to Hex Converter
Convert base-10 decimal integers (including negative numbers and huge 64/128/256-bit integers) to hexadecimal with a complete repeated-division-by-16 breakdown.
Repeated Division by 16 (Read Remainders Bottom to Top)
| Step | Division | Quotient | Remainder | Hex Digit |
|---|
How Repeated Division Converts Decimal to Hexadecimal
To convert a base-10 integer into base 16, repeatedly divide the integer quotient by 16 and record each remainder (0 through 15). Stop when the quotient reaches 0, map remainders 10–15 to letters A–F, and read the digits from bottom to top.
Worked Example: Convert 255₁₀ to Hexadecimal
255 ÷ 16 = 15with remainder 15 (F) — least significant digit.15 ÷ 16 = 0with remainder 15 (F) — most significant digit.- Read from bottom to top: FF₁₆.
Common Decimal to Hex Values
| Decimal | Hexadecimal | Binary | Significance |
|---|---|---|---|
| 10 | A | 1010 | First hex letter |
| 16 | 10 | 10000 | Base 16 radix |
| 255 | FF | 11111111 | Max unsigned 8-bit byte |
| 256 | 100 | 100000000 | 16² (2⁸) |
| 4096 | 1000 | 1000000000000 | 4 KiB memory page size |
| 65535 | FFFF | 1111111111111111 | Max unsigned 16-bit integer / TCP port |
Common Mistakes & Use Cases
- Reading remainders top-to-bottom: The first remainder is always the rightmost (least-significant) hex digit.
- Confusing negative sign-magnitude with two's complement: Entering
-255here outputs-FF. If you need an 8/16/32-bit two's complement register encoding (like-1 → FF), use the Two's Complement Calculator. - Typical applications: Generating CSS RGB hex colors, formatting hardware register masks, converting Unix timestamps or IDs to compact hex strings.
Frequently Asked Questions
How do I convert decimal 255 to hex?
Divide 255 by 16 to get quotient 15 remainder 15 (F), then divide 15 by 16 to get quotient 0 remainder 15 (F). Reading bottom to top yields FF.
Does uppercase vs lowercase hex change the numeric value?
No. 0xFF and 0xff represent the exact same number (255). Use the lowercase toggle if your codebase style guide prefers lowercase hex literals.
Can I convert decimal numbers larger than 9 quadrillion?
Yes. Because this tool uses native JavaScript BigInt arithmetic, integers of hundreds of digits convert cleanly without rounding.