Decimal to Hexadecimal Converter
Convert decimal (base-10) numbers to hexadecimal (base-16) instantly. Hex is widely used in programming for memory addresses, color codes, and data representation.
Common Values
| Input | Hexadecimal |
|---|---|
| 0 | 0 |
| 10 | a |
| 15 | f |
| 16 | 10 |
| 31 | 1f |
| 32 | 20 |
| 64 | 40 |
| 100 | 64 |
| 127 | 7f |
| 128 | 80 |
| 255 | ff |
| 256 | 100 |
| 512 | 200 |
| 1000 | 3e8 |
| 1024 | 400 |
| 4096 | 1000 |
| 65535 | ffff |
How It Works
To convert decimal to hexadecimal, repeatedly divide by 16 and record the remainders. Remainders 0-9 stay as digits; remainders 10-15 become letters A-F. For example, 255: 255÷16=15 R15(F), 15÷16=0 R15(F) — reading upward gives FF. Hex is compact: two hex digits represent exactly one byte (0-255).
Worked Examples
| Decimal | Hexadecimal |
|---|---|
| 0 | 0 |
| 10 | a |
| 15 | f |
| 16 | 10 |
| 31 | 1f |
| 32 | 20 |
| 255 | ff |
| 256 | 100 |
| 4096 | 1000 |
| 65535 | ffff |
Related Conversions
Frequently Asked Questions
- How do I convert decimal to hexadecimal?
Repeatedly divide the number by 16. Convert each remainder to a hex digit (0-9 stay as-is, 10-15 become A-F). Read the remainders from bottom to top.
- What is 255 in hex?
255 in hexadecimal is FF. Two hex digits represent exactly one byte, so FF is the maximum byte value.
- Why is hex used for color codes?
HTML/CSS colors use hex because a color has three 8-bit channels (R, G, B), each 0-255. Two hex digits compactly express each channel: #FF0000 is pure red.
- What is 0x prefix in hex?
The "0x" prefix is a programming convention indicating a hexadecimal number, used in C, Python, JavaScript, and most other languages. It is not part of the number itself.