About the Hex Calculator
A hex calculator converts between decimal and hexadecimal, base 16. Hex is the standard shorthand for binary data because one hex digit represents exactly four bits, which is why it appears in colour codes, memory addresses, MAC addresses, and error codes.
The formula
n = dₖ·16ᵏ + … + d₁·16¹ + d₀·16⁰Each digit runs 0 to 9 then A to F, where A is 10 through F is 15. Place values are 1, 16, 256, 4096 and so on.
How to use this calculator
- 1Enter your Decimal Number. The field starts at
4095, which you can overwrite. - 2Read the result straight away — it recalculates as you type, so there is no button to press. Use Share to copy a link that reopens the page with your exact numbers filled in.
Worked example
| Input | Value |
|---|---|
| Decimal Number | 4095 |
Result
Hexadecimal:
#FFF
Those are the values the page loads with, so you can reproduce this result yourself and then change one field at a time to see what drives the outcome.
Understanding your result
The reason hex exists is compactness with an exact binary mapping. Four bits have sixteen possible values, so each hex digit corresponds to precisely one nibble: 1111 is F, 1010 is A. That means you can convert between hex and binary digit by digit with no arithmetic, which is why programmers read memory dumps in hex rather than binary.
Colour codes are the most familiar use. In #FF5733 each pair of hex digits is one byte giving a channel intensity from 0 to 255 — FF is 255 for full red, 57 is 87 for green, 33 is 51 for blue. Two hex digits per channel is exactly the range a byte provides, which is why the convention settled there.
Things worth knowing
- Hex is conventionally prefixed with 0x in code or # for colours, to distinguish 10 (ten) from 0x10 (sixteen).
- Each hex digit is exactly four bits, so two hex digits make one byte.
- FF is 255, the maximum single byte value, and 0xFFFF is 65,535.
- Hex digits are case-insensitive: 0xff and 0xFF are identical.
- To convert hex to binary, expand each digit to its four-bit pattern separately — no division needed.
Frequently asked questions
Why is hexadecimal used in computing?+
Because each hex digit maps to exactly four binary bits, so hex is a compact, exact shorthand for binary. A byte needs eight binary digits but only two hex digits, making addresses and data far easier to read.
What do the letters A to F represent?+
The values 10 through 15, which base 16 needs single symbols for. So 1A in hex is 1 × 16 + 10 = 26 in decimal.
How do hex colour codes work?+
Each pair of digits gives one colour channel from 0 to 255. In #FF5733, FF is red at full intensity, 57 is green at 87, and 33 is blue at 51. Three bytes describe the colour completely.
How do I convert hex to binary?+
Replace each hex digit with its four-bit equivalent. A is 1010 and F is 1111, so AF becomes 10101111. No arithmetic is required, which is the whole advantage of hex.