Binary Operations Calculator — AND, OR, XOR, NOT
Apply a bitwise logic operation (AND, OR, XOR, NOT, NAND, NOR, or XNOR) to two binary numbers entered as bit strings. See the result in binary, decimal, and hex with a column-by-column breakdown.
Operation
Binary: 1000 • Hex: 0x8
Input A
Input B
Bit position 3
Bit position 2
Bit position 1
Bit position 0
Result
- 1
A in decimal
10 - 2
B in decimal
12 - 3
AND result
10 AND 12 = 8Bitwise AND applied column by column within the 4-bit width.
How does this calculator work?
Binary logic operations apply bit by bit: AND(1,1)=1, OR(0,1)=1, XOR(1,1)=0, NOT(1)=0 — and NAND/NOR/XNOR are their complements. Enter two binary numbers and choose an operation above to see the column-by-column result in binary, decimal, and hex.
Formula
How this is calculated
Binary logic operations work bit by bit on corresponding positions of two operands. AND outputs 1 only when both input bits are 1; OR outputs 1 when at least one input bit is 1; XOR outputs 1 when exactly one input bit is 1 (they differ); NOT flips every bit. NAND, NOR, and XNOR are the complements of AND, OR, and XOR respectively — their result is the bitwise NOT of the corresponding basic gate output.
The calculator pads the shorter input with leading zeros so both operands are the same width, then applies the chosen operation column by column from left (MSB) to right (LSB). For bit widths of 8 or fewer, every column is shown explicitly. Inversion (NOT, NAND, NOR, XNOR) is applied within the bit width of the wider input, so leading 1-bits never appear in the output.
All values are computed with JavaScript BigInt for exact arbitrary-precision results, then displayed in binary, decimal, and hexadecimal.
Frequently asked questions
OR outputs 1 when one OR both bits are 1 (inclusive-or). XOR outputs 1 only when exactly one bit is 1 and the other is 0 (exclusive-or). When both bits are 1, OR gives 1 but XOR gives 0.
NOT flips every bit within the operand's bit width. A small number like 1010₂ has only four bits; flipping them gives 0101₂ (5). If you NOT a longer number, more bits get flipped, yielding a larger result. The output width matches the wider of the two inputs.
XOR is used in error detection and correction (parity, CRC, Hamming codes), cryptographic primitives, fast in-place swapping of two values without a temporary variable, and toggle operations in hardware and software.
Also known as
TG we-Calculate Editorial Team. (2026). Binary Operations Calculator — AND, OR, XOR, NOT [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/binary-operations-calculator
TG we-Calculate Editorial Team. "Binary Operations Calculator — AND, OR, XOR, NOT." TG we-Calculate. 2026. https://we-calculate.com/calculator/binary-operations-calculator.
TG we-Calculate Editorial Team, "Binary Operations Calculator — AND, OR, XOR, NOT," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/binary-operations-calculator
@misc{wecalculate_binary_operations_calculator, title = {Binary Operations Calculator — AND, OR, XOR, NOT}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/binary-operations-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
