English
← Back to redstone circuits

💡 FERMO CUBE GUIDE · REDSTONE

Two-way light switch

One lever at the bottom of the stairs, another at the top, and a single lamp: flip either lever and the lamp changes state. Just like the two-way switch in a real house! In redstone, this is called an exclusive OR (XOR) logic gate.

Java: mechanics verified Bedrock: mechanics verified Difficulty: medium

📦 Materials needed

Tick the materials as you get them ready.

0 / 5 materials ready

These quantities match the circuit in this guide, with the levers close by. To move the levers further away (at the top and bottom of a staircase), bring extra redstone dust for the two lines, plus one repeater every 15 blocks of dust. In Survival, comparators need Nether Quartz.

🧭 How to read this guide

The circuit fits in a rectangle of 5 columns (0 to 4) and 9 rows (A to I). The lamp is in the middle, in E2. Lever 1 is in A2 (for example at the bottom of the stairs) and lever 2 in I2 (at the top). Layer 0 is your flat ground: the whole circuit sits on it, on layer 1.

A comparator or a repeater is always placed "facing away from you": its output points in the direction you're looking.

🏗️ Building steps

1 Place the lamp.

On flat ground, place the redstone lamp in E2.

2 Place the 2 comparators facing the lamp.

Stand to the left of the lamp and, looking toward it, place a comparator in E1. Go to the other side and, looking toward the lamp, place the second comparator in E3. Both of their outputs point into the lamp.

3 Switch them to subtract mode.

Right-click (use) each comparator: the small torch at the front lights up. That's subtract mode.

4 Place the 2 input repeaters.

Place a repeater in B2 while looking toward the lamp, then another one in H2, again looking toward the lamp. Leave them on the default setting (1 tick).

5 Lay out lever 1's loop.

Place 7 redstone dust: C0, C1, C2, C3, then D0 and E0 (it reaches the back of comparator E1), and D3 (it reaches the side of comparator E3). Leave D1 and D2 empty.

6 Lay out lever 2's loop.

Place 7 redstone dust: G1, G2, G3, G4, then F4 and E4 (it reaches the back of comparator E3), and F1 (it reaches the side of comparator E1). Leave F0, F2 and F3 empty.

7 Place the levers.

Place a lever on the ground in A2, right behind repeater B2, and another on the ground in I2, right behind repeater H2.

8 Try it!

Both levers off: the lamp is off. Flip lever 1: it turns on. Flip lever 2: it turns off. Flip lever 1 again: it turns back on. Each lever changes the lamp's state, whatever the other one is doing.

🧱 Diagrams

Top view, then two side views. Hover over a square to see the block name.

Layer 1 (placed on the ground)

Lever 1 at the top of the diagram, lever 2 at the bottom, the lamp in the middle between the 2 comparators.

Side view (row E)

Both comparators point into the lamp.

Side view (column 2)

From left to right: lever 1, repeater, dust, lamp, dust, repeater, lever 2.

📋 Truth table

Lever 1Lever 2Lamp
offoffoff
onoffon
offonon
ononoff

Result: every time you flip a lever, the lamp goes from on to off, or the other way round.

🪜 For a real staircase

To put lever 1 at the bottom of the stairs, remove it from A2 and run a line of redstone dust, as long as you like, to the back of repeater B2 (arriving through square A2). Put a lever at the start of the line. Do the same for lever 2 with repeater H2. Add a repeater every 15 blocks of dust so the signal doesn't die on the way, and make sure these lines don't touch any other dust in the circuit.

🔍 Why it works

1. A comparator in subtract mode takes the signal arriving at its back and subtracts the strongest signal arriving at its sides. If anything is left, it sends it out the front, here into the lamp.

2. Each dust loop goes to two places: lever 1's loop reaches the back of comparator E1 and the side of comparator E3. Lever 2's loop does the opposite: back of E3, side of E1. The two loops never touch.

3. The signal loses 1 strength for each dust. The input repeater always sends a signal of 15: it arrives with a strength of 11 at the back of one comparator (5 dust) and 13 at the side of the other (3 dust).

4. Only one lever on: one comparator gets 11 at the back and nothing at the side, so it sends 11 into the lamp, which turns on. Both levers on: each comparator gets 11 at the back but 13 at the side, 11 − 13 gives 0: neither turns on, and the lamp goes off.

5. The repeaters also act as a "one-way valve": the signal from one loop can't flow back toward the other lever.

New to redstone? Start with the redstone torch inverter, another very simple logic gate.

⚙️ Information

Reference version: Java 26.3 and Bedrock 26.66 (rules checked on the official wiki in November 2026)

Type: Redstone circuit (exclusive OR / XOR logic gate with comparators)

Size: 5 × 9 blocks, 1 block high, levers included

Java Edition: Mechanics verified

Bedrock Edition: Mechanics verified

The circuit is the same on Java and Bedrock. It uses no redstone torches: you can flip the levers as fast as you like, nothing burns out. Don't place anything in the empty squares around the lamp and the comparators (D1, D2, D4, F0, F2, F3): one extra dust could connect the two loops.