Decimal and hexadecimal
Decimal (base 10) is the everyday system: each digit is worth a power of 10. Hexadecimal (base 16) writes each group of 4 bits as one digit from 0 to F, so one byte is always two hex digits; it is the language of memory addresses, colors and hashes.
Needed to write a byte value, an offset, a Unicode code point (U+00E9) or a color channel in the form other tools expect.
This page opens the base converter with decimal as the input; it shows binary, octal, decimal, hexadecimal and Base64 at once, accepts prefixes such as 0x, 0b and 0o, and works with numbers of any length (no 2^53 limit). It runs in your browser.
Decimal vs hexadecimal
| Decimal | hexadecimal | |
|---|---|---|
| Base | 10 | 16 |
| Digits | 0–9 | 0–9 A–F |
| Prefix in code | — | 0x |
| 255 is written | 255 | FF |
How to convert decimal to hexadecimal by hand
Divide by 16 again and again and write down the remainders; read them from the last to the first. For 156:
| Division | Quotient | Remainder |
|---|---|---|
| 156 ÷ 16 | 9 | C |
| 9 ÷ 16 | 0 | 9 |
Read upwards: 156 = 9C in hexadecimal.
Decimal to hexadecimal table
Values computed by the converter itself:
| Decimal | Hexadecimal |
|---|---|
0 | 0 |
1 | 1 |
2 | 2 |
7 | 7 |
8 | 8 |
10 | A |
15 | F |
16 | 10 |
32 | 20 |
64 | 40 |
100 | 64 |
127 | 7F |
255 | FF |
256 | 100 |
1000 | 3E8 |
1024 | 400 |
4096 | 1000 |
65535 | FFFF |
Decimal to hexadecimal in code
JavaScript
(156).toString(16); // '9c'Python
format(156, "X") # '9C'For integers beyond 2^53 in JavaScript, use BigInt: BigInt("0x…").toString(16).
Frequently asked questions
Does it handle very large numbers?
Yes. The converter uses arbitrary-precision integers (BigInt), so a 256-bit hash or a 100-digit number converts exactly; JavaScript Number would lose digits above 2^53.
Can I convert negative numbers or fractions?
Negative integers keep their sign (-255 → -FF); the tool does not write two’s complement or fractional digits. For a two’s complement byte, add 256 first (−1 → 255 → FF).
Why do programmers use hexadecimal instead of binary?
Because it is binary in short form: 4 bits per digit, 2 digits per byte, so 0xFF is easier to read than 11111111 and still maps bit for bit.