Redstonery
RedstoneryCircuits › XNOR gate
Logic circuit

XNOR gate

Detect that two inputs agree.

13 × 17 footprint4 layers108 blocksTested in 4 rotationsJava Edition 26.2
Open in the simulatorBuild it in the game

Layout

Layer 0 (on the floor)
lever [face=floor, facing=north, powered=false] at x 0, z 0redstone dust at x 1, z 0redstone dust at x 2, z 0redstone dust at x 3, z 0redstone dust at x 4, z 0repeater [facing=west, delay=1] at x 5, z 0redstone dust at x 6, z 0redstone dust at x 7, z 0redstone dust at x 8, z 0redstone dust at x 9, z 0redstone dust at x 10, z 0repeater [facing=west, delay=1] at x 11, z 0redstone dust at x 12, z 0repeater [facing=north, delay=1] at x 2, z 1redstone dust at x 2, z 2redstone dust at x 2, z 3redstone dust at x 2, z 4redstone dust at x 2, z 5redstone dust at x 2, z 6redstone dust at x 2, z 7redstone dust at x 2, z 8repeater [facing=north, delay=1] at x 2, z 9stone at x 4, z 4redstone dust at x 4, z 5redstone dust at x 4, z 6redstone dust at x 4, z 7redstone dust at x 4, z 8repeater [facing=north, delay=1] at x 4, z 9redstone dust at x 2, z 10redstone dust at x 3, z 10redstone dust at x 4, z 10redstone dust at x 3, z 11stone at x 3, z 12redstone torch (on a wall) [facing=south] at x 3, z 13repeater [facing=north, delay=1] at x 3, z 14redstone dust at x 3, z 15repeater [facing=north, delay=1] at x 8, z 1redstone dust at x 8, z 2redstone dust at x 8, z 3redstone dust at x 8, z 4redstone dust at x 8, z 5redstone dust at x 8, z 6redstone dust at x 8, z 7stone at x 8, z 8redstone torch (on a wall) [facing=south] at x 8, z 9stone at x 10, z 4redstone dust at x 10, z 5redstone dust at x 10, z 6redstone dust at x 10, z 7stone at x 10, z 8redstone torch (on a wall) [facing=south] at x 10, z 9redstone dust at x 8, z 10redstone dust at x 9, z 10redstone dust at x 10, z 10redstone dust at x 9, z 11stone at x 9, z 12redstone torch (on a wall) [facing=south] at x 9, z 13repeater [facing=north, delay=1] at x 9, z 14redstone dust at x 9, z 15redstone dust at x 3, z 16redstone dust at x 4, z 16repeater [facing=west, delay=1] at x 5, z 16redstone dust at x 6, z 16redstone dust at x 7, z 16redstone dust at x 8, z 16redstone dust at x 9, z 16redstone dust at x 10, z 16redstone lamp at x 11, z 16
Layer 1 (1 up)
stone at x 4, z 3redstone dust at x 4, z 4stone at x 10, z 3redstone dust at x 10, z 4
Layer 2 (2 up)
stone at x 0, z 0stone at x 1, z 0stone at x 2, z 0stone at x 3, z 0stone at x 4, z 0stone at x 5, z 0stone at x 6, z 0stone at x 7, z 0stone at x 8, z 0stone at x 9, z 0stone at x 10, z 0stone at x 11, z 0stone at x 12, z 0stone at x 4, z 1stone at x 4, z 2redstone dust at x 4, z 3stone at x 10, z 1stone at x 10, z 2redstone dust at x 10, z 3
Layer 3 (3 up)
lever [face=floor, facing=north, powered=false] at x 0, z 0redstone dust at x 1, z 0redstone dust at x 2, z 0redstone dust at x 3, z 0redstone dust at x 4, z 0repeater [facing=west, delay=1] at x 5, z 0redstone dust at x 6, z 0redstone dust at x 7, z 0redstone dust at x 8, z 0redstone dust at x 9, z 0redstone dust at x 10, z 0repeater [facing=west, delay=1] at x 11, z 0redstone dust at x 12, z 0repeater [facing=north, delay=1] at x 4, z 1redstone dust at x 4, z 2repeater [facing=north, delay=1] at x 10, z 1redstone dust at x 10, z 2
redstone dustredstone torchrepeater or comparatorinputlampsolid blockarrows point where a device sends its output; north is up

How it works

On when the two inputs agree, including both off. The raised rails carry independent inputs into visible torch AND terms; repeaters isolate the output OR rails. Allow 60 game ticks for this teaching layout to settle.

  1. The circuit produces the inverse of the XOR condition.
  2. The output is on for both-off and both-on; changing either input alone turns it off.

Truth table

Settled outputs after the inputs stop changing. 1 is on, 0 is off. Every row is checked in the simulator in all four rotations.

ABA equals B
001
100
010
111

Inputs and outputs

  • InputA (x 0, y 0, z 0)
  • InputB (x 0, y 3, z 0)
  • OutputA equals B (x 10, y 0, z 16)

Blocks you need

63 × redstone dust, 25 × stone, 13 × repeater, 4 × redstone torch (on a wall), 2 × lever, 1 × redstone lamp.

Build it in the game: 108 commands

Relative to where you stand, with x running east and z running south. Paste one line at a time into chat, or into a chain of command blocks. The block art is the game's own; the layout is what the page above shows.

setblock ~0 ~0 ~0 minecraft:lever[face=floor,facing=north,powered=false]
setblock ~1 ~0 ~0 minecraft:redstone_wire
setblock ~2 ~0 ~0 minecraft:redstone_wire
setblock ~3 ~0 ~0 minecraft:redstone_wire
setblock ~4 ~0 ~0 minecraft:redstone_wire
setblock ~5 ~0 ~0 minecraft:repeater[facing=west,delay=1]
setblock ~6 ~0 ~0 minecraft:redstone_wire
setblock ~7 ~0 ~0 minecraft:redstone_wire
setblock ~8 ~0 ~0 minecraft:redstone_wire
setblock ~9 ~0 ~0 minecraft:redstone_wire
setblock ~10 ~0 ~0 minecraft:redstone_wire
setblock ~11 ~0 ~0 minecraft:repeater[facing=west,delay=1]
setblock ~12 ~0 ~0 minecraft:redstone_wire
setblock ~0 ~2 ~0 minecraft:stone
setblock ~0 ~3 ~0 minecraft:lever[face=floor,facing=north,powered=false]
setblock ~1 ~2 ~0 minecraft:stone
setblock ~1 ~3 ~0 minecraft:redstone_wire
setblock ~2 ~2 ~0 minecraft:stone
setblock ~2 ~3 ~0 minecraft:redstone_wire
setblock ~3 ~2 ~0 minecraft:stone
setblock ~3 ~3 ~0 minecraft:redstone_wire
setblock ~4 ~2 ~0 minecraft:stone
setblock ~4 ~3 ~0 minecraft:redstone_wire
setblock ~5 ~2 ~0 minecraft:stone
setblock ~5 ~3 ~0 minecraft:repeater[facing=west,delay=1]
setblock ~6 ~2 ~0 minecraft:stone
setblock ~6 ~3 ~0 minecraft:redstone_wire
setblock ~7 ~2 ~0 minecraft:stone
setblock ~7 ~3 ~0 minecraft:redstone_wire
setblock ~8 ~2 ~0 minecraft:stone
setblock ~8 ~3 ~0 minecraft:redstone_wire
setblock ~9 ~2 ~0 minecraft:stone
setblock ~9 ~3 ~0 minecraft:redstone_wire
setblock ~10 ~2 ~0 minecraft:stone
setblock ~10 ~3 ~0 minecraft:redstone_wire
setblock ~11 ~2 ~0 minecraft:stone
setblock ~11 ~3 ~0 minecraft:repeater[facing=west,delay=1]
setblock ~12 ~2 ~0 minecraft:stone
setblock ~12 ~3 ~0 minecraft:redstone_wire
setblock ~2 ~0 ~1 minecraft:repeater[facing=north,delay=1]
setblock ~2 ~0 ~2 minecraft:redstone_wire
setblock ~2 ~0 ~3 minecraft:redstone_wire
setblock ~2 ~0 ~4 minecraft:redstone_wire
setblock ~2 ~0 ~5 minecraft:redstone_wire
setblock ~2 ~0 ~6 minecraft:redstone_wire
setblock ~2 ~0 ~7 minecraft:redstone_wire
setblock ~2 ~0 ~8 minecraft:redstone_wire
setblock ~2 ~0 ~9 minecraft:repeater[facing=north,delay=1]
setblock ~4 ~2 ~1 minecraft:stone
setblock ~4 ~3 ~1 minecraft:repeater[facing=north,delay=1]
setblock ~4 ~2 ~2 minecraft:stone
setblock ~4 ~3 ~2 minecraft:redstone_wire
setblock ~4 ~1 ~3 minecraft:stone
setblock ~4 ~2 ~3 minecraft:redstone_wire
setblock ~4 ~0 ~4 minecraft:stone
setblock ~4 ~1 ~4 minecraft:redstone_wire
setblock ~4 ~0 ~5 minecraft:redstone_wire
setblock ~4 ~0 ~6 minecraft:redstone_wire
setblock ~4 ~0 ~7 minecraft:redstone_wire
setblock ~4 ~0 ~8 minecraft:redstone_wire
setblock ~4 ~0 ~9 minecraft:repeater[facing=north,delay=1]
setblock ~2 ~0 ~10 minecraft:redstone_wire
setblock ~3 ~0 ~10 minecraft:redstone_wire
setblock ~4 ~0 ~10 minecraft:redstone_wire
setblock ~3 ~0 ~11 minecraft:redstone_wire
setblock ~3 ~0 ~12 minecraft:stone
setblock ~3 ~0 ~13 minecraft:redstone_wall_torch[facing=south]
setblock ~3 ~0 ~14 minecraft:repeater[facing=north,delay=1]
setblock ~3 ~0 ~15 minecraft:redstone_wire
setblock ~8 ~0 ~1 minecraft:repeater[facing=north,delay=1]
setblock ~8 ~0 ~2 minecraft:redstone_wire
setblock ~8 ~0 ~3 minecraft:redstone_wire
setblock ~8 ~0 ~4 minecraft:redstone_wire
setblock ~8 ~0 ~5 minecraft:redstone_wire
setblock ~8 ~0 ~6 minecraft:redstone_wire
setblock ~8 ~0 ~7 minecraft:redstone_wire
setblock ~8 ~0 ~8 minecraft:stone
setblock ~8 ~0 ~9 minecraft:redstone_wall_torch[facing=south]
setblock ~10 ~2 ~1 minecraft:stone
setblock ~10 ~3 ~1 minecraft:repeater[facing=north,delay=1]
setblock ~10 ~2 ~2 minecraft:stone
setblock ~10 ~3 ~2 minecraft:redstone_wire
setblock ~10 ~1 ~3 minecraft:stone
setblock ~10 ~2 ~3 minecraft:redstone_wire
setblock ~10 ~0 ~4 minecraft:stone
setblock ~10 ~1 ~4 minecraft:redstone_wire
setblock ~10 ~0 ~5 minecraft:redstone_wire
setblock ~10 ~0 ~6 minecraft:redstone_wire
setblock ~10 ~0 ~7 minecraft:redstone_wire
setblock ~10 ~0 ~8 minecraft:stone
setblock ~10 ~0 ~9 minecraft:redstone_wall_torch[facing=south]
setblock ~8 ~0 ~10 minecraft:redstone_wire
setblock ~9 ~0 ~10 minecraft:redstone_wire
setblock ~10 ~0 ~10 minecraft:redstone_wire
setblock ~9 ~0 ~11 minecraft:redstone_wire
setblock ~9 ~0 ~12 minecraft:stone
setblock ~9 ~0 ~13 minecraft:redstone_wall_torch[facing=south]
setblock ~9 ~0 ~14 minecraft:repeater[facing=north,delay=1]
setblock ~9 ~0 ~15 minecraft:redstone_wire
setblock ~3 ~0 ~16 minecraft:redstone_wire
setblock ~4 ~0 ~16 minecraft:redstone_wire
setblock ~5 ~0 ~16 minecraft:repeater[facing=west,delay=1]
setblock ~6 ~0 ~16 minecraft:redstone_wire
setblock ~7 ~0 ~16 minecraft:redstone_wire
setblock ~8 ~0 ~16 minecraft:redstone_wire
setblock ~9 ~0 ~16 minecraft:redstone_wire
setblock ~10 ~0 ~16 minecraft:redstone_wire
setblock ~11 ~0 ~16 minecraft:redstone_lamp