How binary arithmetic works
Binary uses only two digits, 0 and 1. Each position represents a power of 2, starting from 20 on the right. For example, 10102 = 1×23 + 0×22 + 1×21 + 0×20 = 1010.
Subtraction, multiplication, and division follow the same column-wise rules you learned for decimal numbers — only the base is different.
Bitwise logic operations
| Operation | Rule (bit-by-bit) | Example |
|---|---|---|
| AND | 1 only if both bits are 1 | 1010 AND 1100 = 1000 |
| OR | 1 if either bit is 1 | 1010 OR 1100 = 1110 |
| XOR | 1 if bits differ | 1010 XOR 1100 = 0110 |
| NOT | Flip every bit (within bit-width) | NOT 1010 = 0101 |
FAQ
What's the largest binary number I can enter?
JavaScript supports safe integers up to 253 − 1, which is a 53-bit binary number. Beyond that, precision may drop.
Why does NOT give a different answer than expected?
NOT flips bits within a fixed bit-width. By default we use the shortest bit-width that holds your input. For example, NOT 1010 in 4 bits = 0101.
Can I enter negative numbers?
This calculator treats binary inputs as unsigned positive integers. Subtraction with a larger B will return a negative decimal equivalent.