How decimal to hexadecimal conversion works
Hexadecimal is base 16: each digit position is worth 16position, using the
digits 0–9 and then a–f for the values 10–15. To convert decimal to hex by hand, divide
repeatedly by 16 and read the remainders from last to first. For 900:
900 ÷ 16 = 56 remainder 4, 56 ÷ 16 = 3
remainder 8, 3 ÷ 16 = 0 remainder 3 — reading upward gives
384, and 3×16² + 8×16 + 4 = 900 confirms it.
The tool runs the same division with arbitrary-precision integers, so no digit is dropped
at any magnitude.
Input rules and limits
- Base 10 is preselected: digits 0–9, no prefix. A
0xprefix in the decimal field is an error, not 16. Switch the selector to base 2 (digits 0–1) or base 16 (digits 0–9, a–f, case-insensitive) to convert the other way. - One optional leading
+or-. Signed values are supported: the minus is a mathematical sign, so-42converts to-2a. Two's-complement 32-bit or 64-bit wrapping is not performed. - Leading and trailing whitespace is ignored. Commas, underscores, spaces, decimal points and exponent notation inside the number are rejected with a message naming the offending character.
- Maximum 4096 digits (about 16,384 bits). Longer input is refused up front instead of being computed partially.
- Hex output is lowercase and unprefixed. Zero is printed as
0in every base;-0is normalised to0.
What this tool does not do
- No fractional or IEEE-754 conversion:
1.5,1e3and bit-level float interpretation are out of scope and rejected. - No bases other than 2, 10 and 16, and no two's-complement int64/uint64 view.
- No batch conversion or file upload in this version.
Decimal to hex values you can check by hand
| Decimal input | Hexadecimal output | Binary output |
|---|---|---|
| 0 | 0 | 0 |
| 16 | 10 | 10000 |
| 255 | ff | 11111111 |
| -42 | -2a | -101010 |
| 4095 | fff | 12 ones |
| 65535 | ffff | 16 ones |
| 1048576 | 100000 | 1, then 20 zeros |
| 4294967295 | ffffffff | 32 ones |
| 9007199254740993 | 20000000000001 | 1, then 52 zeros, then 1 |
Uppercase spellings name the same values: ff is FF and
-2a is -2A. This tool prints hexadecimal in lowercase and
without a 0x prefix.
Starting from a hexadecimal value?
The hex to decimal converter reads a hexadecimal integer — or a binary one — and returns the exact decimal, with the same input rules and the same 4096-digit limit.
Frequently asked questions
How do I convert 255 to hexadecimal?
Divide repeatedly by 16 and keep the remainders: 255 = 15 × 16 + 15,
and the hexadecimal digit for 15 is f in both positions, so 255 converts to
ff. Uppercase FF names the same value; this tool prints
hexadecimal in lowercase without a prefix.
What is -42 in hexadecimal?
-42 converts to -2a, because 42 = 2 × 16 + 10
and the hexadecimal digit for 10 is a. The leading minus is a mathematical
sign: this tool does not reinterpret the value as a 32-bit or 64-bit two's-complement bit
pattern.
Why is 9007199254740993 in hex 20000000000001 and not 20000000000000?
9007199254740993 is 253 + 1. Converters that compute through
double-precision floating point cannot represent that value and silently round it down to
253, printing 20000000000000. This tool uses arbitrary-precision
integers, so the decimal value stays exact and the answer keeps the final 1:
20000000000001.
Does the decimal to hex conversion handle numbers larger than 64 bits?
Yes — up to 4096 input digits, well past the 64-bit range. The 64-bit boundaries 9223372036854775807 and 18446744073709551615 are just ordinary values here, and no two's-complement wrapping is performed.
Can I type a hex value on this page?
The input base selector starts on base 10 decimal, which is what decimal to hex conversion
needs. Switching it to base 16 lets you type hexadecimal digits instead, and the same
converter returns the exact decimal and binary values. A 0x prefix in the
decimal field is an error, not 16.
Privacy
Everything runs in this page. Your numbers are not sent anywhere, not stored, and not logged. This site counts page visits with PurrHog, a self-hosted analytics server run by the same operator: a visit sends only the page path and a random per-tab identifier — never anything you type and never a result. Any HTTP request, including that one, shows your IP address and standard connection metadata to the receiving server; event data is kept for one year. Your browser's Do Not Track or Global Privacy Control signal disables sending entirely. No cookies, no ads, no third-party code.