
Video: Minecraft - Redstone XOR and XNOR Gates by zephenryus
How to build it
- Set Up the Two Inputs
Place two solid blocks with one empty space between them and attach a lever to the front of each block to serve as Input A and Input B. Place a third block between and one block behind them to form a small T-shape or 3-block front row.
- Build the Input AND Gate & Inverters
Place a redstone torch on top of the two outer input blocks, and place redstone dust on top of the middle block between them. Attach a third redstone torch to the back of that middle block to complete the standard AND gate.
- Wire the Secondary Torch Stage
Behind the two outer input blocks, place a line of redstone dust on the ground so each dust is powered by the top torches. Notice that the center AND-gate torch also points into this back area, allowing it to power both sides when active.
- Add the Side Inverter Torches
Place two more solid blocks behind the dust lines you just placed. Attach redstone torches to the back (or inner sides) of these blocks so they are controlled by the dust behind the input blocks.
- Combine into an OR Output (XOR Gate)
Run redstone dust from those two newly placed torches so their signals merge into a single output line. You now have a complete compact XOR gate that turns ON when only one lever is flipped.
- Convert to an XNOR Gate (Optional)
To turn your XOR gate into an XNOR gate, run the merged output dust into one final solid block and attach a redstone torch to the opposite side. This inverts the final signal so the output stays ON whenever both levers are in the same position.
How it works
The XOR gate implements the logic expression (A AND NOT B) OR (NOT A AND B). While you can build this literally by wiring two separate NOT gates into two AND gates and merging them into an OR gate, the compact design achieves the exact same logic in a fraction of the space:
- Both Inputs OFF (0, 0): The two top torches on the input blocks remain ON, powering the dust behind them. This keeps the two back output torches turned OFF, so the final XOR output is OFF.
- One Input ON (1, 0 or 0, 1): Turning on one lever turns off its top torch. Because the center AND gate requires both top torches to be off before it activates, the middle torch stays OFF. The unpowered dust on the active side lets its back torch turn ON, powering the final output line.
- Both Inputs ON (1, 1): Both top torches turn OFF, which allows the center AND-gate torch to turn ON. This single center torch powers the dust on both sides simultaneously, forcing both back torches OFF again and turning the final output OFF.
- XNOR Inversion: Adding a NOT gate (a block with a redstone torch) to the very end flips the truth table, outputting ON when inputs are equal and OFF when they differ.
Tips & variations
- Two-Way Drawbridge / Door Switch: Place one input lever on the outside of a lava drawbridge or piston door and the second lever on the inside. Because flipping either lever always changes the state from equal to unequal (or vice versa), you can open or close the bridge from either side at any time.
- Full vs. Compact Layout: Building the textbook gate with two separate NOT gates and two separate AND gates requires crossing wires with a bridge block. Always use the compact shared-AND design in survival builds to save space and redstone torches.
- Cross-Edition Compatibility: Because this circuit only uses basic redstone dust and redstone torches (pure Boolean torch logic), it works reliably in any version of Minecraft.





