CalcBoard / All Free Calculators / Hex & Binary Converter
Hex, Decimal, Octal & Binary Converter
All four bases at once — type in any of them — plus the bitwise operations, with results shown in hex and binary too.
Download CalcBoard FreeBase Converter
Type in any field — the other three update as you go, the way CalcBoard’s programmer mode shows all four bases at once.
Bitwise
Bitwise results are 32-bit and signed, because that is what
JavaScript operators do: ~12 is −13, and values past 231 wrap. Base
conversion above is limited to 253. CalcBoard’s programmer mode uses
arbitrary-size integers and has neither ceiling.
Reference table
| Decimal | Hex | Octal | Binary |
|---|---|---|---|
| 8 | 8 | 10 | 1000 |
| 10 | A | 12 | 1010 |
| 15 | F | 17 | 1111 |
| 16 | 10 | 20 | 1 0000 |
| 64 | 40 | 100 | 100 0000 |
| 127 | 7F | 177 | 111 1111 |
| 128 | 80 | 200 | 1000 0000 |
| 255 | FF | 377 | 1111 1111 |
| 1024 | 400 | 2000 | 100 0000 0000 |
| 65535 | FFFF | 177777 | 1111 1111 1111 1111 |
Converting by hand
Hex to decimal
Each hex digit is a power of 16, counting from the right. 2F is
2×16 + 15 = 47. 1A3 is
1×256 + 10×16 + 3 = 419. The letters A–F stand for 10–15.
Hex to binary
This one is mechanical, and it is why hex exists: each hex digit is exactly four
binary digits. F is 1111, A is 1010,
so FA is 1111 1010. No arithmetic required — just substitute.
That four-bit group is a nibble, and it is why the binary field above is grouped in fours.
Decimal to binary
Halve repeatedly and record the remainders, then read them bottom to top. 13 → 6 r1,
3 r0, 1 r1, 0 r1 → 1101.
The bitwise operations
| Operation | Does | Example |
|---|---|---|
| AND (&) | 1 only where both bits are 1 | 12 & 10 = 8 |
| OR (|) | 1 where either bit is 1 | 12 | 10 = 14 |
| XOR (^) | 1 where the bits differ | 12 ^ 10 = 6 |
| NOT (~) | flips every bit | ~12 = −13 |
| Left shift (<<) | multiplies by 2 per place | 3 << 4 = 48 |
| Right shift (>>) | divides by 2 per place, discarding remainder | 48 >> 4 = 3 |
Masking is the everyday use: value & 0xFF keeps the low byte,
value | 0x80 sets the top bit of a byte, and
(rgb >> 16) & 0xFF pulls the red channel out of a packed colour.
Where this tool stops
Two real limits, both of which the app does not have. JavaScript's bitwise operators are
32-bit and signed, so ~12 shows as −13 and anything past
231 wraps. And whole numbers above 253 cannot be represented exactly in a
browser at all.
CalcBoard's programmer mode keeps all four bases on screen permanently rather than in a converter box, has hex A–F keys on the keypad, and falls back to arbitrary-size integers instead of overflowing. It is part of the one-time $2.99 Premium unlock.
Frequently Asked Questions
How do I convert hex to decimal?
Why is hexadecimal used in programming?
What is 0xFF in decimal?
What does the AND operator do?
Does this handle 64-bit values?
Four bases, always on screen
Programmer mode shows BIN, OCT, DEC and HEX at once, offline, with no 32-bit ceiling.
Download Free on App Store