Binary Operations Calculator
Result
A AND B 1000 (8)
A OR B 1110 (14)
A XOR B 110 (6)
Perform bitwise AND, OR, and XOR on two binary numbers and see every result in both binary and decimal. Enter two strings of 0s and 1s and this calculator lines them up bit by bit and applies each logical operation.
Formula
AND, OR, XOR applied bit by bit to two base-2 numbers
- Each binary number is converted to decimal, the bitwise operation is applied, and the result is shown in binary with its decimal value in parentheses.
- AND outputs 1 only where both bits are 1.
- OR outputs 1 where at least one bit is 1.
- XOR outputs 1 where the two bits differ.
- Inputs must contain only 0 and 1. A leading '0b' prefix is accepted and ignored. Shorter numbers are treated as if padded with leading zeros.
1100 with 1010
Inputs
- Binary A: 1100
- Binary B: 1010
1100₂ = 12 and 1010₂ = 10. AND = 1000₂ (8), OR = 1110₂ (14), XOR = 0110₂ (6).
Frequently asked questions
What is a bitwise AND?
AND compares the two numbers bit by bit and outputs 1 only when both corresponding bits are 1; otherwise it outputs 0.
How is OR different from XOR?
OR outputs 1 when either bit (or both) is 1. XOR (exclusive OR) outputs 1 only when the bits are different, so two 1s give 0.
What if the two numbers have different lengths?
The shorter number is treated as if it has leading zeros, so the operation lines up the least-significant bits correctly.
Why show the decimal value too?
Seeing the decimal equivalent in parentheses makes it easy to verify the result and connect the binary logic to ordinary arithmetic.
Can I enter a '0b' prefix?
Yes. A leading 0b is stripped automatically, so 0b1100 and 1100 are treated identically.