Glossary Definition for XOR Gate

Glossary Term: XOR Gate 


What is an XOR Gate?

“XOR” an abbreviation for “Exclusively-OR.” The simplest XOR gate is a two-input digital circuit that outputs a logical “1” if the two input values differ, i.e., its output is a logical “1” if either of its inputs are 1, but not at the same time (exclusively). The symbol and truth table for an XOR is shown in Figure 1. The Boolean expression for a two-input XOR gate, with inputs A and B and output X:

Digital XOR Gate Symbol

Figure 1. Symbol and truth table for a digital XOR gate


What is an XOR gate used for?

The XOR gate has many applications in electronic circuits. It is used in simple digital addition circuits which calculate the sum and carry of two (half-adder) or three (full-adder) bit numbers.

XOR gates are also used to determine the parity of a binary number, i.e., if the total number of 1’s in the number is odd or even. The output of the XOR function, which is 1 if the number of 1’s is odd and 0 if the number of 1’s is even, is referred to as a ‘parity’ bit. This result can be used to perform simple error checking on blocks of digital data being transmitted across a communications link. The parity bit is transmitted along with the original block of data. The receiver performs the XOR function on the received data and if the result matches the received parity bit then there is a limited degree of reassurance that a data error (where a 1 became a 0 or vice versa) did not occur during transmission.

XOR gates are a fundamental building block of cryptographic circuits because XOR logic acts as a simple cipher, i.e., performing an XOR of a digitized message with a binary key produces encrypted ciphertext. Performing an XOR of the ciphertext with the same key reproduces the original message.

Learn more via our Application Notes:

Find a term alphabetically: