What Does a 3-Input XOR Gate Do?
At a glance
- 1. Count the ones
A 3-input XOR outputs 1 when an odd number of its inputs are 1.
- 2. Check the truth table
The output is 1 for one or three high inputs, and 0 for zero or two.
- 3. Build the gate
Connect two 2-input XOR gates in series; XOR is associative.
A 3-input XOR gate combines three binary inputs, usually named , , and . Its output is 1 when the inputs contain an odd number of 1s. That means the output is 1 for either exactly one high input or three high inputs.
This parity rule distinguishes XOR from ordinary OR: OR is 1 whenever at least one input is 1, while a 3-input XOR can return 0 even when inputs are high.
Truth table
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
For example, inputs contain two 1s, an even count, so the output is 0. Inputs contain three 1s, an odd count, so the output is 1.
Boolean expression
The standard compact expression is
Here, means exclusive OR. Since XOR is associative, the expression can be grouped either way:
If you need an expression using only AND, OR, and NOT, write each input combination that produces 1 as a product term, then OR those terms together. Using a prime to mean NOT, the result is
Each term corresponds to one row of the truth table: the first three terms represent cases with exactly one 1, and represents the case with three 1s.
Build it from 2-input XOR gates
You do not need a special three-input component to implement the function. Use two ordinary XOR gates:
- Feed and into the first XOR gate.
- Feed its output and into the second XOR gate.
The resulting output is , which equals because XOR is associative.
For a concrete check, let , , and . The first gate gives ; the second gives . The final output is 0, as expected for two input 1s. With , the first gate gives 0 and the second gives .
Why it is called a parity gate
A 3-input XOR computes the odd-parity bit of its inputs. It reports whether the number of 1s is odd. This property is useful in parity generation and checking, where an extra bit can be selected or tested to detect certain bit errors. With an even number of inputs, the same chained-XOR rule still applies: the output is 1 exactly when the total number of 1s is odd.
Common mistakes
- Treating XOR as OR: For inputs , OR gives 1, but XOR gives 0 because there are two 1s.
- Assuming “exclusive” means exactly one input is 1: That is true for a 2-input XOR, but not for a 3-input XOR. Three 1s also produce 1.
- Changing the grouping: Grouping does not change the result, but changing the operation does. The expression uses XOR at both stages, not OR or AND.
- Confusing XOR with XNOR: XNOR is the complement of XOR. A 3-input XNOR is 1 when the number of input 1s is even.
References
- Digital Design, 6th Edition — M. Morris Mano and Michael D. Ciletti
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.