Format Code Now
/

XNOR Calculator

CU-26

Enter two numbers such as 12 and 10 and get their bitwise XNOR in decimal, signed decimal, hex and binary. XNOR is 1 where the two input bits are equal.

Runs in your browser. Nothing is uploaded.

Number pairs, one per line (12 10 or 12 XNOR 10)

XNOR results

How to use it

  1. Type or paste one pair of numbers per line, for example 12 10 or 12 XNOR 10.
  2. Pick the bit width (8, 16, 32 or 64) and how numbers without a prefix are read.
  3. Press Calculate XNOR for decimal, signed, hex and binary results, Binary view to line the bits up, or Truth table for the one-bit gate.
  4. Copy the result or download it as a text file.

What XNOR does

XNOR is XOR followed by NOT. A result bit is 1 when the two input bits are the same (0 and 0, or 1 and 1), and 0 when they differ. It is the equality test of bits. A number XNOR itself is all ones: 5 XNOR 5 is 255 at 8 bits. For 12 and 10 at 8 bits, 00001100 XNOR 00001010 gives 11111001, which is 249.

Width, signs and input

XNOR flips bits with NOT, so the width you pick sets how many ones appear. Numbers can be decimal, or written with 0x for hex, 0b for binary and 0o for octal, or bare numbers can be read as binary or hexadecimal. A negative decimal is stored as the unsigned value of that width, and a number too big for the width is an error, not a silent cut. 64-bit numbers are exact.

Limits

Each line takes two operands. The tool is the bitwise operator for whole numbers, not a wiring simulator, and it does not chain three or more inputs. The Binary view lines up both numbers and the result, so you can see which bit positions matched.

Error messages and what to do

MessageWhat it meansFix
Line 1: write two numbers such as 12 10 or 12 XNOR 10 (got "abc").The line does not hold exactly two numbers, optionally with the operator word between them.Write two numbers, for example 12 10 or 12 XNOR 10.
Line 1: 300 does not fit in 8 bits (allowed -128 to 255).A number is too big for the chosen bit width. The tool refuses it instead of cutting bits off.Choose a wider bit width or use a smaller number.

Questions people ask

What is XNOR?

XNOR is the opposite of XOR. It outputs 1 when both inputs are the same and 0 when they differ. It is also called equivalence or XOR-NOT, and it is the one-bit equality gate.

How do I calculate XNOR of two numbers?

XOR the numbers bit by bit, then flip every bit up to the width. For 12 and 10 at 8 bits, 12 XOR 10 is 6 (00000110), and flipping gives 11111001, which is 249. The Binary view shows this.

What is the XNOR truth table?

Inputs 0,0 give 1; 0,1 give 0; 1,0 give 0; and 1,1 give 1, so the output is 1 only when both inputs are equal. Press Truth table to see it printed in a small grid.

Why is XNOR of a number with itself all ones?

Every bit is equal to itself, so every result bit is 1. At 8 bits the answer is 255, at 16 bits 65535, and so on. It makes XNOR a handy test for equality.

Does the bit width change the result?

Yes. The NOT step flips every bit up to the width, so the same two numbers give 249 at 8 bits and 4294967289 at 32 bits. Pick the width of the data you are working with.

Can I use hex or binary input?

Yes. Use 0xFF, 0b1010 or 0o17, or set bare numbers to binary or hexadecimal with the option. Negative decimals are read in two's complement at the chosen width.

About this tool

XNOR is XOR followed by NOT, bit by bit: a result bit is 1 when the two input bits are equal and 0 when they differ. A number XNOR itself is therefore all ones: 5 XNOR 5 is 255 in 8 bits. Each line holds two whole numbers, with or without the word XNOR between them. Numbers can be decimal, 0x hex, 0b binary or 0o octal, or you can choose binary or hexadecimal for numbers without a prefix. The width matters because NOT flips every bit up to that width. A negative decimal is stored as the matching unsigned value, and a number that does not fit the width is an error. 64-bit values are exact. Only two operands per line are supported.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.