The short answer
Binary is base-2: every digit (bit) is 0 or 1, and each position represents a power of two. 1010 in binary equals 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal. This calculator handles binary arithmetic, bitwise logic (AND, OR, XOR, NOT), bit shifts, and instant conversion to decimal, hex, and octal.
Key takeaways
- Values are capped at the 32-bit signed integer range (-2,147,483,648 to 2,147,483,647) — binary strings outside that range are rejected rather than silently truncated.
- Bitwise AND/OR/XOR compare numbers bit by bit and are not the same as arithmetic addition or multiplication — 1010 AND 0110 equals 0010, not 16.
- A left shift by n is equivalent to multiplying by 2ⁿ; a right shift by n is equivalent to integer (floor) division by 2ⁿ.
- Each hex digit maps to exactly 4 binary bits, which makes hex-to-binary conversion mechanical once you know the 16 four-bit patterns.
How binary place value works
Just like decimal place value uses powers of ten, binary place value uses powers of two. Reading the 8-bit number 10110101 from right to left:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
Add up the position values where there's a 1: 128 + 32 + 16 + 4 + 1 = 181. So binary 10110101 equals decimal 181.
Bitwise operations vs. arithmetic operations
| Operation | What it does | Example |
|---|---|---|
| AND (&) | 1 only where both bits are 1 | 1010 & 0110 = 0010 |
| OR (|) | 1 where either bit is 1 | 1010 | 0110 = 1110 |
| XOR (^) | 1 where the bits differ | 1010 ^ 0110 = 1100 |
| Left shift (<<) | Shift bits left, fill with 0 (×2ⁿ) | 0011 << 2 = 1100 |
| Right shift (>>) | Shift bits right (÷2ⁿ, rounded down) | 1100 >> 2 = 0011 |
Bitwise operations compare or shift individual bits — they don't carry between positions the way addition does, which is why 1010 AND 0110 lands on 0010 instead of anything resembling a sum.
Common mistakes to avoid
- Treating bitwise AND/OR as if they were arithmetic addition or multiplication — they operate bit by bit with no carrying.
- Forgetting the 32-bit signed range cap — a binary string of more than 31 ones will overflow the supported range and return an error.
- Expecting bitwise NOT to just flip the printed digits — in two's complement representation, NOT-ing a positive number produces a negative one, not a simple digit-reversal.
- Assuming right shift rounds — it truncates (floors) toward negative infinity for negative numbers, so 7 >> 1 = 3, not 3.5 or 4.
Related calculators
- Hex Calculator — work directly in hexadecimal with the same conversions and operations.
- Exponent Calculator — check powers of two behind every bit position and shift.
- Big Number Calculator — go beyond the 32-bit range with arbitrary-precision arithmetic.
- Scientific Calculator — handle general math beyond number-base conversions.