XNOR Calculator
Calculate the bitwise XNOR (exclusive NOR) of two numbers.
Result: A XNOR B
Enter both values to see the result in decimal, hex, binary, and octal.
XNOR truth table
| A | B | A XNOR B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
XNOR Calculator – Bitwise Equivalence
Calculate the bitwise XNOR of two numbers. XNOR (exclusive NOR) is the inverse of XOR: a result bit is 1 when both input bits are equal and 0 when they differ. That makes XNOR an "equality detector" – every 1 in the result marks a position where the two numbers agree. With 8 bits, 12 XNOR 10 = 249 (1111 1001).
How to calculate XNOR
- Write both numbers in binary using the same width, e.g.
0000 1100and0000 1010. - Compare each pair of bits: equal bits give 1, different bits give 0.
- Result:
1111 1001= 249 unsigned, −7 signed.
In code XNOR is usually written ~(a ^ b) followed by a mask for the bit width (& 0xFF, & 0xFFFF, …), because ~ alone produces a negative signed value. The calculator does this for you and shows both interpretations.
Truth table
| A | B | A XNOR B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Where XNOR is used
- Equality comparators – digital circuits compare two binary numbers by XNORing each bit pair and ANDing the results; the output is 1 only when all bits match.
- Binary neural networks – XNOR-Net and similar models replace multiplications with XNOR and a population count, making inference very fast on CPUs and FPGAs.
- Error detection – even-parity checks and some line codes are based on XNOR.
- Counting matching bits – the number of 1s in
a XNOR bequals the width minus the Hamming distance.
Options
Enter values in decimal, hex (0x), binary (0b), or octal (0o), or force an input format. Choose Auto width or a fixed 8, 16, 32, 64, or 128 bits; negative inputs are handled in two's complement. Compare with the XOR Calculator or use the Bitwise Calculator for every operation in one place.
Frequently Asked Questions
What is the difference between XOR and XNOR?
XNOR is the inverse of XOR. XOR gives 1 when bits differ, XNOR gives 1 when bits are equal.
Why is XNOR called the equivalence gate?
Because its output is 1 exactly when both inputs are equivalent (both 0 or both 1). In logic it corresponds to the biconditional 'A if and only if B'.
Why does XNOR produce a large number?
Leading zeros are equal in both numbers, so XNOR turns them into ones and the result fills the whole bit width. Pick the width that matches your data type.