Free forever · No sign-up
Decimal to Hex Converter
Convert any decimal number to hexadecimal instantly — see every division step. Free, fast, no sign-up.
Enter a whole number (digits only).
Your data stays in your browser.
No recent conversions yet.
Also equals
- Binary
- Decimal
- Octal
- Hex
Step-by-step calculation
| Division | Quotient | Remainder (hex) |
|---|
Read the remainders from bottom to top.
How to convert decimal to hex
- Divide the decimal number by 16 and write down the remainder in hex.
- Divide the quotient by 16 and write down the new remainder.
- Repeat until the quotient is 0, then read the remainders from bottom to top.
Example: 419 → 419÷16=26 r3, 26÷16=1 r10 (A), 1÷16=0 r1 → 1A3.
Background reading: the hexadecimal system on Wikipedia.
Conversion table
Decimal 0–15 with the matching hex digit, plus larger worked examples.
| Decimal | Hex | Calculation |
|---|---|---|
| 0 | 0 | 0 = 0 |
| 1 | 1 | 1 = 1 |
| 2 | 2 | 2 = 2 |
| 3 | 3 | 3 = 3 |
| 4 | 4 | 4 = 4 |
| 5 | 5 | 5 = 5 |
| 6 | 6 | 6 = 6 |
| 7 | 7 | 7 = 7 |
| 8 | 8 | 8 = 8 |
| 9 | 9 | 9 = 9 |
| 10 | A | 10 = A |
| 11 | B | 11 = B |
| 12 | C | 12 = C |
| 13 | D | 13 = D |
| 14 | E | 14 = E |
| 15 | F | 15 = F |
| 16 | 10 | 16 ÷ 16 = 1 r 0 → 10 |
| 255 | FF | 255 ÷ 16 = 15 r 15 → FF |
| 4096 | 1000 | 4096 = 16³ → 1000 |
Powers of 16
| Power | Value |
|---|---|
| 160 | 1 |
| 161 | 16 |
| 162 | 256 |
| 163 | 4096 |
| 164 | 65536 |
Decimal to hex in code
Python
hex(255)[2:] # → 'ff'
JavaScript
(255).toString(16); // → 'ff'
C
#include <stdio.h>
int main(void) {
printf("%X\n", 255); /* → FF */
return 0;
}
Real-world applications
- Writing CSS colors — rgb(255, 87, 51) becomes #FF5733.
- Formatting memory addresses and offsets in low-level programming.
- Encoding bytes as readable text in URLs, hashes and UUIDs.
- Setting hardware registers where vendors document values in hex.
Common mistakes
- Writing remainders 10–15 as two digits — they must become the single letters A–F.
- Reading the remainders top-to-bottom instead of bottom-to-top.
- Forgetting that hex digits are case-insensitive — 1a and 1A are the same value.
Common values
- 255 =
FF₁₆ - 16 =
10₁₆ - 10 =
A₁₆ - 256 =
100₁₆ - 0 =
0₁₆ - 4,095 =
FFF₁₆
Key takeaways
- Divide by 16 repeatedly; read remainders bottom-to-top, writing 10–15 as A–F.
- 255 = FF₁₆, 16 = 10₁₆, 4096 = 1000₁₆.
- Each hex digit replaces exactly four binary bits.
- Pad to an even number of digits when working with whole bytes.
Frequently asked questions
How do I convert decimal to hex?
Repeatedly divide by 16, record each remainder in hex, and read the remainders bottom-to-top. The converter above shows every step.
What is 255 in hex?
255 in decimal equals FF in hex.
What do the letters A-F mean in hex?
They stand for the values 10 to 15: A=10, B=11, C=12, D=13, E=14, F=15.
What is 1000 in hex?
1000 in decimal equals 3E8 in hexadecimal.
How do you convert decimal to hex without a calculator?
Divide by 16 repeatedly, convert each remainder to a hex digit (10=A … 15=F), and read the digits bottom-to-top.
How do I convert 255 to hex?
Divide by 16: 255 ÷ 16 = 15 remainder 15 → F, F → FF. So 255 = FF₁₆.
Why do programmers use hex?
Hex is compact: one byte is always exactly two hex digits, and each hex digit maps to exactly four binary bits.
What is 16 in hex?
16 = 10₁₆.
Need the reverse? Try our hex to decimal converter.
More converters
Add this converter to your website
Embed our free binary to decimal converter on your own site with one line of code:
<script src="https://binary-to-decimal-28z.pages.dev/embed.js"></script>