XOR Gate & XNOR Gates: Truth Table, Symbol & Boolean Expression

Xor And Xnor Gate Truth Table & Symbol
💡
Key learnings:
  • XOR Gate Definition: An XOR gate outputs true only when the inputs are different; it is essential in digital logic for comparing signals.
  • Truth Table Overview: The xor gate truth table & xnor gate truth table show how these gates respond to different combinations of inputs, crucial for designing digital systems.
  • Boolean Expressions: Expressions like 𝐴 ⊕ 𝐵 A⊕B for XOR and 𝐴 ⊙ 𝐵 A⊙B for XNOR gates clarify the operations these gates perform, useful in circuit design.
  • Symbols and Diagrams: The symbols for XOR and XNOR gates help in quickly identifying these components in circuit diagrams, aiding in visual learning.
  • Applications in Computing: XOR and XNOR gates are fundamental in computer engineering, used in tasks ranging from arithmetic to error checking.

What is an XOR Gate?

An XOR gate (also known as an EOR or EXOR gate), pronounced Exclusive OR, is a digital logic gate that outputs true (HIGH or 1) when the number of true inputs is odd. For two inputs, exclusive OR is true when exactly one input is true. If both inputs are false (LOW or 0) or both are true, the output is false.

XOR is the inequality function: the output is true when the inputs differ and false when they match. A common reminder is “one or the other, but not both”.

Another way to look at an XOR gate: a modulo-2 sum of two binary variables looks like this:
equation
The logic gate that performs this modulo-2 sum without a carry is the XOR gate. A two-input XOR outputs logical 1 only when exactly one input is logical 1. When both inputs are 1 or both are 0, the output is logical 0.

The XOR gate is also called an anti-coincidence gate or inequality detector because it outputs 1 only when the inputs differ. That exclusive behaviour is the exclusive OR gate operation.

Digital electronics also utilize other logic gates such as NOT gates, OR gates, NAND gates, and NOR gates, each serving unique functions in circuit design.

XOR Gate Truth Table

XOR Gate Truth Table

Truth tables list the output of a particular digital logic circuit for all the possible combinations of its inputs. The truth table of an XOR gate is given below:

The binary operation in that table is exclusive OR, written A ⊕ B. The exclusive-OR symbol is a plus sign inside a circle: ⊕.

XOR Gate Circuit Diagram

The above expression, A ⊕ B can be simplified as,
equation

Let us prove the above expression.
In the first case, consider A = 0 and B = 0.

In the second case, consider A = 0 and B = 1.

In the third case, consider A = 1 and B = 0.

In the fourth case, consider A = 1 and B = 1.

So the Boolean expression for A ⊕ B is AB ̅ + ĀB. That expression matches every output state of an XOR gate’s input conditions.

xor gate logic circuit

From this Boolean expression, the logical circuit of an XOR gate is as shown,

Logical Symbol of XOR Gate

An XOR gate is logically represented as,

logical symbol of xor gate

Multiple Input XOR Gate

Commercial XOR gates are usually two-input devices, but the XOR operation can use any number of inputs (for example a 3 input XOR operation or a 4 input XOR operation).

Cascaded XOR (odd parity) outputs 1 when an odd number of inputs is 1. It outputs logical 0 when no input is 1 or when an even number of inputs is 1. That cascaded form differs from a strict “exactly one input is 1” reading once three or more inputs can all be 1.

3 Input XOR Gate

Realise an XOR operation with three inputs A, B and C.

Now, as per the cascaded (odd-parity) definition of an XOR operation with more than two inputs, the truth table would be:

xor 3 input truth table

This truth table can be elaborated as:

truth table

The above-elaborated truth table shows that the XOR operation of three binary variables is equivalent to the XOR operation of one variable with the result of XOR operations of the other two variables.

From the above truth table, we logically represented this as:
truth table

three input xor logic gate

Applications of XOR Gates

The main application of the Exclusive OR gate (XOR) is in the operation of half and full adder. The first three rows of the two-input truth table match the sum bit of binary addition.

When both inputs are 1, binary addition still needs a 0 sum and a carry of 1. XOR gives the 0 sum bit and does not produce that carry.

circuit diagram of half adder

A half adder therefore places an AND gate in parallel with the Ex-OR gate. The AND output is the carry bit.

The above diagram shows the two inputs feeding an exclusive-OR gate and an AND gate in parallel. That pair of gates produces the sum and carry of binary addition.

Pseudo-random number generation uses exclusive-OR in the feedback path of a linear feedback shift register to produce a repeating but hard-to-predict bit sequence.

Applications in Computing

In computer engineering, XOR and XNOR gates are used for arithmetic and error-checking. Gate count and power matter in digital circuit design. Training-budget rules such as the Chinchilla Point belong to machine learning and do not change the Boolean function of XOR or XNOR.

What is an XNOR Gate?

The XNOR gate (also known as an XORN’T, ENOR, EXNOR or NXOR), pronounced Exclusive NOR, is a digital logic gate whose function is the logical complement of the exclusive OR gate (XOR gate). Logically, an XNOR gate is an XOR gate followed by a NOT gate.

The XOR operation of inputs A and B is A ⊕ B; therefore, the XNOR operation of those inputs is (A ⊕ B) ̅. That means the output of the XOR gate is inverted in the XNOR gate.

In the XOR gate operation, the output is only 1 when only one input is 1. The output is logical 0 when both inputs are the same, meaning they are either 1 or 0. In the XNOR gate the inverse is true. The output is 0 when the inputs differ and 1 when both inputs are the same (two 0s or two 1s).

See the XNOR gate truth table below for a visual representation of this.

XNOR Gate Truth Table

truth table xnor gate

The truth table of the XNOR gate is shown below:

The logical XNOR operation is written A ⊙ B. The symbol is a dot inside a circle: ⊙.
The same truth table matches the equation AB + ĀB ̅.

So A ⊙ B = AB + ĀB ̅. The same identity can be proved with a K-map.

XNOR Gate Circuit Diagram

The expression of XNOR operation can be realized by using two NOT gates, two AND gates and one OR gate as follows,

The symbol of the XNOR gate:

logic circuit of x nor gate
symbol of xnor gate

3 Input XNOR Gate

Like the XOR gate, an XNOR gate has only two inputs, but for XNOR operation with more than two inputs, we have to use more than one XNOR gate.

For more than two inputs, cascaded XNOR (even parity) outputs 0 when an odd number of inputs is high. Otherwise the output is 1.

The logical symbol for a three-input XNOR gate, derived from the detailed truth table, appears as follows:

three input x nor gate
Want To Learn Faster? 🎓
Get electrical articles delivered to your inbox every week.
No credit card required—it’s 100% free.

About Electrical4U

Electrical4U is dedicated to the teaching and sharing of all things related to electrical and electronics engineering.

Leave a Comment