Binary Calculator
This binary calculator adds, subtracts, multiplies and divides binary numbers and applies AND, OR, XOR and NOT. Enter operands in binary; each result is shown in binary and in decimal so you can check it.
Result
10010
Decimal: 18
Check in decimal: 13 + 5 = 18
Examples
- 1101 + 101 = 10010 (13 + 5 = 18)
- 1101 ÷ 101 = 10 remainder 11 (13 ÷ 5 = 2 remainder 3)
- 1100 AND 1010 = 1000
- NOT 101 in 8 bits = 11111010 (NOT 5 (8-bit) = 250)
Arithmetic on binary numbers
Binary arithmetic follows the same rules as decimal, with carries at 2 instead of 10. In addition, 1 + 1 is 10, which means write 0 and carry 1. Subtraction borrows in the same way. Multiplication is a series of shifted copies of the first number, one per 1 bit in the second, which are then added. Division gives a quotient and a remainder, both shown in binary and decimal.
The calculator works on unsigned integers of any size, so there is no overflow. Subtraction where B is larger than A would be negative; the tool reports that instead of showing a two’s complement result. Division by zero is undefined and is reported as an error.
Bitwise operations
AND gives 1 only where both bits are 1. OR gives 1 where at least one bit is 1. XOR gives 1 where exactly one bit is 1. For these operations the result is padded to the length of the longer operand, so alignment is visible.
NOT flips every bit, and the answer depends on how many bits you consider: NOT 101 is 010 in 3 bits but 11111010 in 8 bits. Choose the width (8, 16, 32 or 64) that matches your case. The operand must fit in the chosen width.
Why show decimal as well
A second view catches typos. If 1101 + 101 does not equal 13 + 5 in decimal, an operand was entered incorrectly. The summary line under each result gives the decimal version of the whole calculation.
Frequently asked questions
- What is 1 + 1 in binary?
- 10, which is 2 in decimal. The digit is 0 with a carry of 1.
- Can I subtract a larger number from a smaller one?
- Not here. The calculator is unsigned, so it shows an error rather than a negative or wrapped value.
- What does XOR do?
- It outputs 1 when the two input bits differ and 0 when they are the same.
- Why does NOT need a bit width?
- Because the leading zeros that flip to ones depend on the width; NOT of the same number differs between 8 and 16 bits.