XOR Gate

An XOR gate (Exclusive OR gate) is a fundamental redstone logic circuit that outputs a signal only when one of its two inputs is active, turning off if both inputs are off or both are on. Unlike a standard OR gate, an XOR gate ensures that toggling either input lever will always flip the output state. This makes it ideal for controlling doors, piston entrances, or lighting systems from two separate locations, such as the inside and outside of a base.

Logic GatesBeginnerJava Edition
XOR Gate video tutorial

Video: Redstone Tutorials - #17 XOR Gate by Flabaliki

How to build it

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

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

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

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

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

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

Frequently asked questions

What is the difference between an OR gate and an XOR gate in Minecraft?
An OR gate outputs a signal when one or both levers are ON, meaning if one lever is left ON, the second lever cannot turn the circuit OFF. An XOR gate turns OFF when both levers are ON, allowing either lever to toggle the output at any time.
Why can't I place redstone dust on my slabs?
Redstone dust can only be placed on top slabs (slabs placed in the upper half of a block space). If your slab is on the bottom half, break it and place it against the upper half of an adjacent block or under a temporary ceiling block.
When should I use an XOR gate instead of a T Flip-Flop?
Use an XOR gate when you want to control a mechanism using levers from two locations, and use a T Flip-Flop when you want to toggle a mechanism using buttons or pressure plates.

Components used

More xor gate