MOULDLKnowledge BaseElectrical Knowledge Base3D Model DownloadsMembership
中文版Model Store »
Knowledge Base › Electrical Knowledge Base › XOR and XNOR gates: truth tables and three practical tricks
HomeModels
Table of contents

On this page

Electrical & Electronic Basics (698 articles)

Quick Reference

  • PLC & Programming
  • Electrical & Electronic Basics (monthly)(每月更新中)
  • Electrical Control & Drawings (monthly)(每月更新中)
  • Drives & Actuators (monthly)(每月更新中)
  • Sensors & Detection (monthly)(每月更新中)
  • Industrial Communication & Networks (monthly)(每月更新中)
  • HMI & Host Systems (monthly)(每月更新中)
  • Industrial Robots & Motion Control (monthly)(每月更新中)
  • Mechatronic System Integration (monthly)(每月更新中)
  • Fault Diagnosis & Standards (monthly)(每月更新中)

XOR and XNOR gates: truth tables and three practical tricks

XOR detects difference, XNOR detects equality, and half-adders and parity checks lean on both. This page covers the tables, the identities and the pitfalls that bite in real wiring.

1. How it works

XOR outputs 1 when inputs differ: Y = A⊕B. XNOR is its complement, outputting 1 on equality. The identities do the daily work: A⊕0 = A (pass through), A⊕1 = Ā (controllable inverter), A⊕A = 0 (self-cancelling, used in checksums). Typical parts: 74HC86 (quad XOR) in CMOS, 74LS86 in TTL.

2. Practice and pitfalls

Three applications: half-adders (XOR for the sum bit, AND for carry - XOR underpins arithmetic), parity generation and checking (a tree of XORs over 8 bits flags an odd number of ones - the standard serial-link guard), and equality comparison (eight XNORs into an AND gate beats a subtract-compare by a mile). Practical notes: CMOS inputs must never float - tie every unused input high or low, or the output chatters; unequal input delays produce edge glitches, so sample the XOR output with a D flip-flop in synchronous designs; and driving 5V HC logic from 3.3V sits right at the VIH edge - use 74HCT parts for the interface. Verify a suspect chip against all four input states with switches and an LED in two minutes.

3. XOR and XNOR truth table

ABXOR outXNOR out
0001
0110
1010
1101
A⊕0 = AUnchanged by 0N/ABuffer duty
A⊕1 = ĀInverted by 1N/AControlled inverter

4. Notes

Motto: XNOR for equality, XOR for difference, an XOR tree for parity, one XOR for polarity control. Tie CMOS inputs, match trace delays, and let a flip-flop swallow the glitches.

5. References

The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Digital IC specification per GB/T 17574 (IEC 60748 series); logic symbols per GB/T 4728. Always check the device datasheet and the product design file for ratings and derating.

6. Cautions

⚠️ Three common pitfalls:
① Floating CMOS inputs:the gate drifts with noise and the output chatters
② Mismatched input delays:edge glitches walk into the counter and add phantom counts
③ 3.3V driving 5V HC inputs:VIH sits on the edge, errors multiply when hot

Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.

Related reading

Related 3D models: Ready to build it? Download free 3D models & CAD drawings at MOULDL »
MOULDL · Electrical Knowledge Base · free self-study reference for electrical & automation engineers, 3D CAD models at MOULDL