Decimal to Hex Converter — Instant Base-10 to Hexadecimal
Convert decimal numbers to hexadecimal instantly. Arbitrary precision via BigInt, outputs lowercase hex. Free, runs entirely in your browser.
Supports arbitrary-precision integers via BigInt — no 2⁵³ overflow. Handles negative numbers and the standard 0b/0o/0x prefixes. All conversion happens in your browser.
Converting decimal to hex, explained
Decimal is the base-10 number system humans count with; hexadecimal is the base-16 system programmers and hardware engineers use to write byte values compactly. Converting a decimal number to hex means rewriting it using the digits 0-9 and the letters A-F, where A is 10, B is 11, and so on up to F which is 15. This decimal to hex converter does the conversion instantly in your browser with arbitrary precision via JavaScript BigInt — paste a 20-digit decimal and get the hex equivalent with no rounding.
The conversion algorithm
To convert a decimal number to hex by hand, divide by 16 repeatedly and collect the remainders. Read the remainders in reverse order to form the hex result. For example, converting decimal 675:
675 ÷ 16 = 42 remainder 3 ← lowest hex digit 42 ÷ 16 = 2 remainder 10 → A 2 ÷ 16 = 0 remainder 2 ← highest hex digit Reading remainders bottom-to-top: 2, A, 3 Result: 2A3
So decimal 675 equals hex 2A3. For large numbers, doing this by hand is tedious; the tool above does it instantly and keeps full precision even for numbers beyond JavaScript's Number.MAX_SAFE_INTEGER.
How to use this decimal to hex converter
- Type or paste a decimal (base-10) number into the decimal field.
- The hex field updates live with the base-16 equivalent. Binary and octal also appear for reference.
- Output is lowercase hex without a
0xprefix. Uppercase-ify it yourself if the target system expects that. - Decimal inputs may include leading zeroes, but no spaces or commas. Scientific notation is not supported.
Examples
Decimal Hex 0 0 10 a 15 f 16 10 255 ff # one byte 256 100 4096 1000 65535 ffff # uint16 max 16777215 ffffff # full 24-bit (CSS white) 4294967295 ffffffff # uint32 max
When you actually need decimal to hex
- Writing CSS colors from RGB values. You have RGB channel values like 238, 130, 238 (medium orchid). Convert each to hex and concatenate: EE, 82, EE →
#EE82EE. - Setting register or memory addresses. A low-level tool asks for an address in hex; you have the decimal version from a different source.
- Writing bit masks. You want a mask of the lowest 8 bits. Decimal 255 is hex
FF, the more readable form in a bitmasking expression. - Generating test vectors. A cryptographic spec gives values in decimal; your implementation takes hex inputs.
- Converting a JavaScript Number to bytes. Network protocols and binary formats prefer hex representations.
Common decimal to hex conversions (quick reference)
1 = 1 10 = a 16 = 10 100 = 64 255 = ff # byte max 256 = 100 1024 = 400 # 1 KiB 4096 = 1000 # 4 KiB 65536 = 10000 # 2^16
Why does hex use letters?
Hexadecimal needs 16 distinct single-character symbols. The digits 0-9 cover the first ten; the next six need new symbols. When IBM standardized hex in the 1960s, the letters A-F were the obvious choice — they were already on every typewriter and fit into existing 6-bit character encodings. Alternative systems (such as ones that used symbols like u, v, w, x, y, z) were briefly considered and abandoned.
Privacy
This decimal to hex converter runs entirely in your browser. Conversion happens locally with JavaScript BigInt — no server, no logging, no network calls. Safe for any value you are working with, including internal IDs or keys.
Frequently asked questions
Does the output have a 0x prefix?
No. The tool outputs lowercase hex without a prefix — just ff, not 0xff. Prepend 0x yourself if your target language or spec requires it.
Can I convert decimals (fractions) to hex?
This tool converts integers only. Fractional hex (e.g. 3.2 decimal → 3.3333... hex) is rarely needed and would require explicit precision rules. For floating-point, use IEEE 754 encoding, not fractional hex.
How do I convert a negative decimal to hex?
Hex itself is unsigned; negative values are represented in two's complement at a chosen bit width. For a signed 32-bit integer, -1 is ffffffff. Compute this as 2^N + valuewhere N is your bit width. This tool handles unsigned conversion; apply the two's complement step yourself for signed contexts.
What is the largest decimal I can convert?
Any integer. The tool uses BigInt so there is no practical upper bound — try a 100-digit decimal value, it will convert correctly.
How do I convert decimal to hex in code?
In JavaScript: n.toString(16). In Python: hex(n) (returns with 0x prefix) or f'{n:x}'. In C: printf("%x", n). All produce lowercase by default.
Related tools
- Number BaseConvert numbers between binary, octal, decimal, and hexadecimal instantly. Live bidirectional conversion with explanations — free, runs in your browser.
- Hex to DecimalConvert hexadecimal numbers to decimal instantly. Supports arbitrary precision via BigInt, handles 0x prefix. Free, runs in your browser.
- Decimal to BinaryConvert decimal numbers to binary instantly. Arbitrary precision via BigInt, clean grouped output. Free, runs entirely in your browser.