Electrical engineering

XOR gate

A logic gate performing a Boolean logic XOR operation.

XOR gate: the odd-one-out detector in logic circuits

An XOR gate is a digital logic circuit that outputs a high signal (1) when its two inputs differ from each other, and a low signal (0) when they match. The name comes from "exclusive OR": it returns true only when one input or the other is true, never both. In physical form, an XOR gate is built from transistors and resistors integrated onto a silicon chip, often appearing as a single gate within a larger package containing multiple gates on the same die.

XOR gates have two inputs and one output. When both inputs are 0, the output is 0. When both inputs are 1, the output is also 0. When one input is 1 and the other is 0, the output is 1. This behavior makes XOR fundamentally different from AND or OR gates, which are more commonly taught first. Because of this asymmetry, XOR cannot be manufactured as a single transistor pair; it must be constructed by combining simpler gates like NAND or NOR gates in cascade.

Common applications and limitations

XOR gates are essential in binary arithmetic circuits, particularly in adders where they generate the sum bit. A half-adder uses two XOR gates plus an AND gate to add two single bits. XOR also appears in parity checking for error detection: comparing two data streams with XOR will flag any difference. In multiplexer design and security applications like encryption, XOR is relied upon heavily because its operation is reversible, meaning XOR-ing a value twice with the same key returns the original data.

The main limitation of XOR at the component level is propagation delay. Because an XOR gate must be built from multiple transistors in series, the signal takes longer to propagate through it than through a simple AND or OR gate, typically 15 to 30 nanoseconds in standard CMOS logic families. This matters in high-speed circuits where timing is critical. Additionally, XOR gates consume slightly more power than simpler gates due to the extra transistors required.

In modern integrated circuits, XOR gates are rarely discrete components; they exist as functional blocks within larger chips. Logic designers reference XOR as a primitive operation in hardware description languages like VHDL or Verilog. Industrial datasheets specify XOR behavior using truth tables and timing diagrams rather than internal schematics, since the implementation may vary depending on the semiconductor process and desired speed or power trade-off.

More from Electrical engineering

See all

Get the Word of the Day

One industrial term every weekday, with the trade it belongs to and why it is worth knowing. No advertising.