Bitwise Xor Calculator

April 9th, 2022 by 
PK

Here is a bitwise xor calculator, for performing an xor (exclusive or) between the bits of two numbers converted to 32-bit binary. In a bitwise xor, a binary digit will only be set to 1 if one number has a 1 in a spot, but not if both do.

Bitwise Xor Calculator

Using the Bitwise Exclusive Or Calculator

To use the bitwise xor calculator, enter two numbers to xor in the "Number One" and "Number Two" fields in the tool. Once happy with the inputs, click the "Calculate Bitwise Xor" button.

The result of the bitwise xor will show up in the "Xor'd Number" field, converted to integer:

Result of an xor between 5 and 4 in the tool
Bitwise xor of 5 and 4

Bitwise Xor Example

Behind the scenes, the tool converts the numbers to 32-bit binary numbers, then goes digit by digit and xors the two numbers together – that is, only sets a 1 when a single digit in either number is 1.

Let's do an example together, xoring the numbers 4 and 5 as shown in the screenshot.

5\oplus4=4\\or\\
101\oplus100=001\  (1)

Shown above, the tool converted the numbers 5 and 4 to the binary numbers 101 and 100. Moving in either direction, you can see the 4s digit and the 1s digit were both 1s for the 5, which is a 0 in an xor. The 5 gave us a 1 for the 1s digit that didn't exist in the 4, so we are left with 001, or 1 in binary.

That's the same as the integer 1, as you can see. Contrast the result with the bitwise and which gives you 4, or the bitwise or which leaves 5.

Other Binary Calculator

Try our other binary math calculators:

      

PK

PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.

PK is in his mid-30s and works and lives in the Bay Area with his wife, two kids, and dog.

Don't Quit Your Day Job...

DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases.
Sign Up For Emails
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram