Decimal to hex conversion in one step
This decimal to hex converter rewrites base-10 numbers in hexadecimal (base 16), the compact notation programmers use for bytes, memory addresses, colors and character codes. You can convert integers far larger than 64 bits and values with a fractional part, and the result updates as you type.
What is hexadecimal?
Hexadecimal needs sixteen digits, so after 0–9 it borrows the letters A–F for the values 10 to 15. Each position is worth sixteen times the one to its right.
| Position | Value |
|---|---|
| 16^0 | 1 |
| 16^1 | 16 |
| 16^2 | 256 |
| 16^3 | 4,096 |
| 16^4 | 65,536 |
Because 16 is 2^4, every hex digit stands for exactly four bits. Two hex digits describe one byte, which is why a byte ranges from 00 to FF (0 to 255).
How to convert decimal to hex by hand
Divide the number by 16, note the remainder, and repeat with the quotient until it reaches zero. Write the remainders as hex digits and read them from the last to the first.
48879 ÷ 16 = 3054 remainder 15 → F
3054 ÷ 16 = 190 remainder 14 → E
190 ÷ 16 = 11 remainder 14 → E
11 ÷ 16 = 0 remainder 11 → B
Read from the bottom up: 48879 = BEEF
A second route goes through binary: 255 is 1111 1111, and each group of four bits maps to one hex digit, giving FF. For small numbers the binary route is often faster in your head.
Fractions
For the part after the decimal point, multiply by 16 and take the whole-number part as the next digit. 0.75 × 16 = 12, which is C, so 3.75 becomes 3.C, and 0.5 × 16 = 8 gives 0.8. Fractions such as 0.1 repeat forever in base 16 (0.1999…), so the tool stops after 20 hex places.
Example
Input Output
10 A
255 FF
4096 1000
3735928559 DEADBEEF
3.75 3.C
-255 -FF
Options and input rules
- Letter case: choose upper case (FF) or lower case (ff). The value is identical; the choice only matters for style guides, CSS conventions or byte-for-byte comparisons.
- No prefix is added: the result is the bare digits. Add
0xfor C, JavaScript, Python or Java literals, or#for CSS colors. - Big integers are exact: 18446744073709551615 converts to FFFFFFFFFFFFFFFF with no rounding, because the tool does not rely on floating-point numbers.
- Negatives keep a minus sign: -255 becomes -FF. If you need the 32-bit two's complement form (FFFFFF01), use the bitwise calculator, which shows fixed-width results.
- Separators: spaces, commas, underscores and apostrophes are ignored as digit grouping, so 1,000,000 and 1_000_000 both read as one million. The field holds one number at a time.
Where you will use decimal to hex
- Colors: an RGB color of 255, 136, 0 becomes FF, 88 and 00, or #FF8800. The HEX to RGB converter handles whole colors in both directions.
- Character codes: Unicode code points are written in hex, so é (233) is U+00E9. To encode whole strings, use string to hex.
- Memory and file offsets: debuggers, hex editors and crash logs show addresses in hex.
- Constants and flags: masks such as 0xFF00 are easier to read in hex than as 65280.
Common mistakes
- Forgetting to pad bytes to two digits. Decimal 10 is A, but in a color or a byte string it must be written 0A.
- Reading "10" in hex as ten. It is sixteen; use the hex to decimal converter to check a value you are unsure about.
- Writing the remainders in the order you calculated them instead of reversing them.