
Video: Redstone Tutorials - #17 XOR Gate by Flabaliki
How to build it
- Build the Front Frame
Place a row of 3 solid blocks on the ground. Behind the middle block, place 1 solid block on the ground and stack 1 more solid block directly on top of it.
- Position the Top Slabs
Place 3 top slabs (slabs occupying the upper half of the block space): one behind the left front block, one behind the right front block, and one behind the lower center block. If needed, use temporary blocks above or dig a shallow trench to help aim and place them in the top half.
- Add the Input Levers and Torches
Attach 2 levers to the front side of the outer blocks in your initial 3-block row. Place a redstone torch on the top of both outer blocks, and attach a third redstone torch to the front face of the raised center block.
- Wire the Slab Layer
Place 1 piece of redstone dust on top of each of the 3 top slabs, and 1 piece of redstone dust on top of the front middle full block so it sits right below the front-facing torch.
- Place the Upper Blocks and Rear Torches
Place a solid block directly above the left and right top slabs (sandwiching the redstone dust underneath). Attach a redstone torch to the back face of each of these two new upper blocks.
- Connect the Output Line
Run redstone dust behind the two rear torches so their signals merge into a single output line leading to your door, lamp, or mechanism.
How it works
The XOR gate works by combining and comparing both inputs using redstone torches (which act as inverters) and top slabs (which prevent signals from traveling downward):
- Both Inputs OFF: The two top torches on the input blocks stay lit. They power the dust on the left and right slabs, as well as the dust in the front middle, keeping the center torch turned off. Because the left and right slabs power the upper blocks above them, the two rear output torches remain inverted (OFF), resulting in no output.
- One Input ON: Pulling one lever turns off the torch on top of that input block. However, the opposite input block's torch is still on, which continues to power the front-middle dust and keeps the center torch OFF. The side that was switched on loses power on its slab, turning ON its corresponding rear output torch and powering the output line.
- Both Inputs ON: Pulling both levers turns off both outer input torches. With neither torch powering the front-middle dust, the center redstone torch turns ON. It powers the back-center slab, which feeds power into both the left and right slabs. This re-powers both upper blocks and forces both rear output torches OFF, cutting the output signal.
Tips & variations
- Why Top Slabs Matter: Redstone dust placed on a top slab can send a signal diagonally up to full blocks, cannot send a signal diagonally down, and does not cut off vertical redstone lines next to it. Make sure your slabs are in the upper half of the block space.
- Practical Base Usage: Connect one input lever on the outside of your base and the other input lever on the inside. You can open the door from outside and close it once inside without the levers locking each other out.
- Alternative to T Flip-Flops: While a T Flip-Flop with buttons can also toggle a door from two places, a torch-and-slab XOR gate uses very basic survival resources (no pistons or hoppers required) and is completely silent.





