Redstonery
RedstoneryCircuits › Half adder
Logic circuit

Half adder

Add two bits and keep both sum and carry.

19 × 17 footprint4 layers159 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 0redstone dust at x 13, z 0redstone dust at x 14, z 0redstone dust at x 15, z 0redstone dust at x 16, z 0repeater [facing=west, delay=1] at x 17, z 0redstone dust at x 18, 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 7stone at x 2, z 8redstone torch (on a wall) [facing=south] 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 7redstone dust at x 8, z 8repeater [facing=north, delay=1] 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 16repeater [facing=north, delay=1] at x 14, z 1redstone dust at x 14, z 2redstone dust at x 14, z 3redstone dust at x 14, z 4redstone dust at x 14, z 5redstone dust at x 14, z 6redstone dust at x 14, z 7stone at x 14, z 8redstone torch (on a wall) [facing=south] at x 14, z 9stone at x 16, z 4redstone dust at x 16, z 5redstone dust at x 16, z 6redstone dust at x 16, z 7stone at x 16, z 8redstone torch (on a wall) [facing=south] at x 16, z 9redstone dust at x 14, z 10redstone dust at x 15, z 10redstone dust at x 16, z 10redstone dust at x 15, z 11stone at x 15, z 12redstone torch (on a wall) [facing=south] at x 15, z 13repeater [facing=north, delay=1] at x 15, z 14redstone dust at x 15, z 15redstone dust at x 15, z 16redstone dust at x 16, z 16redstone lamp at x 17, 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 4stone at x 16, z 3redstone dust at x 16, 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 13, z 0stone at x 14, z 0stone at x 15, z 0stone at x 16, z 0stone at x 17, z 0stone at x 18, 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 3stone at x 16, z 1stone at x 16, z 2redstone dust at x 16, 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 0redstone dust at x 13, z 0redstone dust at x 14, z 0redstone dust at x 15, z 0redstone dust at x 16, z 0repeater [facing=west, delay=1] at x 17, z 0redstone dust at x 18, 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 2repeater [facing=north, delay=1] at x 16, z 1redstone dust at x 16, z 2
redstone dustredstone torchrepeater or comparatorinputlampsolid blockarrows point where a device sends its output; north is up

How it works

Add two one-bit values. Sum has weight one; Carry has weight two. 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. XOR produces the sum bit and AND produces the carry bit.
  2. The two outputs together represent A + B, including the value two.

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.

ABSumCarry
0000
1010
0110
1101

Inputs and outputs

  • InputA (x 0, y 0, z 0)
  • InputB (x 0, y 3, z 0)
  • OutputSum (x 10, y 0, z 16)
  • OutputCarry (x 16, y 0, z 16)

Blocks you need

92 × redstone dust, 38 × stone, 18 × repeater, 7 × redstone torch (on a wall), 2 × lever, 2 × redstone lamp.

Build it in the game: 159 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 ~13 ~0 ~0 minecraft:redstone_wire
setblock ~14 ~0 ~0 minecraft:redstone_wire
setblock ~15 ~0 ~0 minecraft:redstone_wire
setblock ~16 ~0 ~0 minecraft:redstone_wire
setblock ~17 ~0 ~0 minecraft:repeater[facing=west,delay=1]
setblock ~18 ~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 ~13 ~2 ~0 minecraft:stone
setblock ~13 ~3 ~0 minecraft:redstone_wire
setblock ~14 ~2 ~0 minecraft:stone
setblock ~14 ~3 ~0 minecraft:redstone_wire
setblock ~15 ~2 ~0 minecraft:stone
setblock ~15 ~3 ~0 minecraft:redstone_wire
setblock ~16 ~2 ~0 minecraft:stone
setblock ~16 ~3 ~0 minecraft:redstone_wire
setblock ~17 ~2 ~0 minecraft:stone
setblock ~17 ~3 ~0 minecraft:repeater[facing=west,delay=1]
setblock ~18 ~2 ~0 minecraft:stone
setblock ~18 ~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:stone
setblock ~2 ~0 ~9 minecraft:redstone_wall_torch[facing=south]
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:redstone_wire
setblock ~8 ~0 ~9 minecraft:repeater[facing=north,delay=1]
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
setblock ~14 ~0 ~1 minecraft:repeater[facing=north,delay=1]
setblock ~14 ~0 ~2 minecraft:redstone_wire
setblock ~14 ~0 ~3 minecraft:redstone_wire
setblock ~14 ~0 ~4 minecraft:redstone_wire
setblock ~14 ~0 ~5 minecraft:redstone_wire
setblock ~14 ~0 ~6 minecraft:redstone_wire
setblock ~14 ~0 ~7 minecraft:redstone_wire
setblock ~14 ~0 ~8 minecraft:stone
setblock ~14 ~0 ~9 minecraft:redstone_wall_torch[facing=south]
setblock ~16 ~2 ~1 minecraft:stone
setblock ~16 ~3 ~1 minecraft:repeater[facing=north,delay=1]
setblock ~16 ~2 ~2 minecraft:stone
setblock ~16 ~3 ~2 minecraft:redstone_wire
setblock ~16 ~1 ~3 minecraft:stone
setblock ~16 ~2 ~3 minecraft:redstone_wire
setblock ~16 ~0 ~4 minecraft:stone
setblock ~16 ~1 ~4 minecraft:redstone_wire
setblock ~16 ~0 ~5 minecraft:redstone_wire
setblock ~16 ~0 ~6 minecraft:redstone_wire
setblock ~16 ~0 ~7 minecraft:redstone_wire
setblock ~16 ~0 ~8 minecraft:stone
setblock ~16 ~0 ~9 minecraft:redstone_wall_torch[facing=south]
setblock ~14 ~0 ~10 minecraft:redstone_wire
setblock ~15 ~0 ~10 minecraft:redstone_wire
setblock ~16 ~0 ~10 minecraft:redstone_wire
setblock ~15 ~0 ~11 minecraft:redstone_wire
setblock ~15 ~0 ~12 minecraft:stone
setblock ~15 ~0 ~13 minecraft:redstone_wall_torch[facing=south]
setblock ~15 ~0 ~14 minecraft:repeater[facing=north,delay=1]
setblock ~15 ~0 ~15 minecraft:redstone_wire
setblock ~15 ~0 ~16 minecraft:redstone_wire
setblock ~16 ~0 ~16 minecraft:redstone_wire
setblock ~17 ~0 ~16 minecraft:redstone_lamp