Beginner

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.
Binary digits (0 and 1 only)
Ignored for NOT operation

Operation

Result (decimal)
8

Binary: 1000 • Hex: 0x8

A (binary)
1010
B (binary)
1100
Result (binary)
1000
Result (hex)
0x8
Bit-by-bit AND operation
1

Input A

1010
2

Input B

1100
3

Bit position 3

1 & 1 = 1
4

Bit position 2

0 & 1 = 0
5

Bit position 1

1 & 0 = 0
6

Bit position 0

0 & 0 = 0
=

Result

1000
0246810121416ABresultOperands and result within the 4-bit range
Step by step
  1. 1

    A in decimal

    10
  2. 2

    B in decimal

    12
  3. 3

    AND result

    10 AND 12 = 8
    Bitwise AND applied column by column within the 4-bit width.
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

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
AND: A & B OR: A | B XOR: A ^ B NOT: ~A & mask NAND: ~(A & B) NOR: ~(A | B) XNOR: ~(A ^ B)
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

binary and or xor calculator
binary logic operations
bitwise binary operations
binary not nand nor xnor
binary boolean calculator
binary gate operations
binary logical operators

APA

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

Chicago

TG we-Calculate Editorial Team. "Binary Operations Calculator — AND, OR, XOR, NOT." TG we-Calculate. 2026. https://we-calculate.com/calculator/binary-operations-calculator.

IEEE

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

BibTeX

@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?