Free exact browser converter
Decimal to Hex Converter
Convert non-negative decimal integers to hexadecimal online with BigInt precision. Choose uppercase, lowercase, or 0x output and validate every digit.
Interactive tool
Convert Decimal to Hex
Ready
Choose a clear output representation.
Detailed conversion guide
How to Convert Decimal to Hex
Convert the decimal digit string directly to BigInt, then format its exact value in base 16. Repeated division by 16 produces remainders 0–15, written as 0–9 and A–F. Decimal 255 is hex FF.
Decimal 9007199254740993 exceeds the safe integer limit of JavaScript Number. BigInt preserves it as hex 20000000000001. Uppercase, lowercase, and the 0x prefix change presentation only.
| Input | Output | Meaning |
|---|---|---|
0 | 0 | zero |
10 | A | decimal 10 |
255 | FF | decimal 255 |
9007199254740993 | 20000000000001 | large integer |
Decimal to Hex without Number Rounding
The algorithm validates the representation before exact integer conversion, so malformed input never produces a plausible partial answer.
const digits = input.trim();
if (!/^[0-9]+$/.test(digits)) throw Error("Invalid decimal integer");
const value = BigInt(digits);
const hex = value.toString(16).toUpperCase();Unsigned Integers, Separators, and Precision
Only non-negative whole decimal integers are supported. Negative numbers, decimal points, commas, exponent notation, and two’s-complement assumptions produce a warning and no output.
Spaces and underscores are removed before validation and join one integer; 2 55 means 255. Leading zeros do not define an output width. Use fixed-width padding in your own protocol if needed.
Related converters
Continue with exact representation converters
Choose the converter for the input and output formats you are working with.