Online XOR Calculator is a free online tool to calculate XOR value of two integers. This geeksforgeeks online XOR Calculator makes the calculation faster and it displays the conversion in a fraction of seconds.
XOR Operator:
XOR is a bitwise operator, and it stands for “exclusive or.” It performs logical operation. If input bits are the same, then the output will be false(0) else true(1).
XOR Gate Formula:
The Exclusive OR (or XOR) relationship F = A ⊕ B is defined by the truth tables shown below:
XOR truth table:
To find out the XOR value of two numbers we can convert it into binary representation and then do the logical XOR operation on each bit and then convert it into a decimal value .
XOR examples:
Input : A = 7 , B = 9
Output: 14
Explanation : A = 7 ( 0111 )2 , B = 9 ( 1001 )2
- 1st bit of A = 1 and B = 1 so XOR value will be 0
- 2nd bit of A = 1 and B = 0 so XOR Value will be 1
- 3rd bit of A = 1 and B = 0 so XOR Value will be 1
- 4th bit of A = 0 and B = 1 so XOR Value will be 1
XOR value has binary representation : (1110)2
Decimal value of XOR = 14
FAQs on Online XOR Calculator
1. What is the XOR of 5 and 3?
XOR value of 5 and 3 will be 6.
Explanation : Convert 5 and 3 to their binary representations, i.e. 101 and 011. Then use the table to determine that 101 XOR 011 , i.e. 110, which is the binary representation of the decimal number 6.
2. What is the XOR of two sets?
The XOR of two sets A and B, contains all the elements that are either in set A or set B, but not in both. It can be calculated as: A XOR B = (A Union B) – (A Intersection B)
3. What is XOR Sum?
XOR sum refers to successive XOR operations on integers.
Suppose you have numbers from 1 to N and you have to find their XOR sum then :
For N = 6, XOR sum will be 1^2^3^4^5^6 = 7.
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!
Last Updated :
13 Oct, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...