XOR and XNOR Gates

An XOR (Exclusive OR) gate is a fundamental redstone logic circuit that turns its output ON only when its two inputs are different from each other. An XNOR gate is simply the inverted version, turning ON when both inputs are matching. These gates are essential in Minecraft whenever you want to control a single mechanism—such as a door or a lava drawbridge—independently from two different levers.

Logic GatesBeginnerJava Edition
XOR and XNOR Gates video tutorial

Video: Minecraft - Redstone XOR and XNOR Gates by zephenryus

How to build it

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Frequently asked questions

What is the difference between an XOR gate and an OR gate?
A standard OR gate outputs ON when one OR both inputs are ON. An XOR (Exclusive OR) gate only outputs ON when one input is ON, and turns OFF if both inputs are ON at the same time.
How do you turn an XOR gate into an XNOR gate?
Simply invert the final output of the XOR gate by running the output redstone dust into a solid block with a redstone torch attached to it.
What is an XOR gate used for in Minecraft?
It acts like a real-life three-way hallway light switch. You can wire two levers in different locations—such as both sides of a bridge or doorway—to open and close the same mechanism from either side.

Components used

More xor gate