Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksToolsOpen the lab →

How to build a 1-to-8 demultiplexer from logic gates

A 1-to-8 demultiplexer sends one data input D to one of eight outputs, Y0 to Y7, chosen by the 3-bit select S2 S1 S0, and holds every other output at 0. Each output is D ANDed with the decoding of its own number: Y5 = D AND S2 AND NOT S1 AND S0.

It is a 3-to-8 decoder with D ANDed into every output, and the reverse of an 8-to-1 multiplexer. To save gates this one predecodes: four ANDs decode S1 S0 once, two more combine D with S2 and NOT S2, and each output ANDs one line from each group. The smallest demultiplexer, 1-to-2, is just Y0 = D AND NOT S and Y1 = D AND S, and the 1-to-4 demultiplexer sits in between. All 16 combinations of D and the select are checked before the page is built.

Big circuit: pinch, scroll or tap + to zoom in, then drag to move around.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

What you need

Step by step

  1. Place inputs D, S2, S1 and S0 and probes Y0 to Y7.
  2. Decode S1 S0 with two NOT gates and four ANDs into four lines, one per value 00 to 11.
  3. AND D with NOT S2 and with S2 to get two lines, one for each half of the outputs.
  4. For each output i, AND the S2 line for i div 4 with the S1 S0 line for i mod 4.
  5. Turn D on and count S2 S1 S0 from 000 to 111: the 1 walks from Y0 to Y7.

1-to-8 demultiplexer truth table

S2 S1 S0Output that gets D
000Y0
001Y1
010Y2
011Y3
100Y4
101Y5
110Y6
111Y7

With D = 0 every output is 0, whatever the select. Tie D to 1 and the same circuit is a 3-to-8 decoder; used the other way round, D works as an enable input.

You can also read the full theory in the lesson on encoders and demultiplexers. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

Build more parts from gates

half adderfull adderhalf subtractorfull subtractor2:1 multiplexer4:1 multiplexerXOR gate from NAND gates2-to-4 decoderSR latchD flip-flopJK flip-flopT flip-flop4-bit shift register4-bit ripple carry adderD latch1-to-4 demultiplexer4-bit magnitude comparator4-bit ring counter4-bit Johnson counter4-to-2 priority encoder4-bit synchronous counter3-to-8 decoder8-to-1 multiplexer4-bit carry lookahead adderhalf adder from NAND gates2-bit comparatorBCD to 7-segment decoder4-bit up/down counterdecade counter2-bit multiplier4-bit ALU4-bit array multiplierNOT, AND, OR and NOR from NANDNOT, OR, AND and XOR from NORfull adder from NAND gatesSR latch from NAND gatesparity generator and checker4-bit adder/subtractorBCD adder4-bit universal shift registermod-6 counter4-bit ripple counterbinary to Gray code converterhalf adder from NOR gatesfull adder from NOR gates4-bit register with parallel load1011 sequence detectorbinary to BCD converterD flip-flop from NAND gates1-bit ALUCMOS inverterCMOS NAND gateCMOS NOR gatePISO shift registerSR flip-flop from NAND gatesBCD to excess-3 code converterHamming (7,4) code encoder and correctortraffic light controller4-bit barrel shifterCMOS AND gateCMOS OR gateCMOS XOR gate1-bit magnitude comparatorhalf subtractor from NAND gatesfull subtractor from NAND gates8-to-3 encoderGray to binary converter4-to-16 decoderfull adder using 4:1 multiplexersedge detectorserial adder4-bit carry-select adderMealy machine (1011 detector)master-slave JK flip-flop (NAND)half subtractor from NOR gatesexcess-3 to BCD code convertervending machine FSM4-bit carry-save adder3-bit synchronous counter (JK)CMOS transmission gatetri-state buffer (CMOS)2-to-1 mux from transmission gatesmod-5 counterflip-flop conversion (JK to D)8-bit ALUdecimal to BCD encoderBCD to decimal decoder4-to-1 mux from 2-to-1 muxes

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the 1-to-8 demultiplexer in the lab →

Frequently asked

What is a 1 to 8 demultiplexer?

A circuit with one data input, three select inputs and eight outputs that routes the data input to the output numbered by the select value. All other outputs stay 0.

How many select lines does a 1-to-8 demultiplexer have?

Three, because 2 to the power 3 is 8. A 1-to-n demultiplexer needs log2(n) select lines.

What is a 1 to 2 demultiplexer?

The smallest demultiplexer: one select line S, with Y0 = D AND NOT S and Y1 = D AND S. It takes one NOT and two AND gates.

What is the difference between a demultiplexer and a decoder?

A decoder turns a number into one active line; a demultiplexer also has a data input that it steers to that line. A decoder with an enable input is the same circuit as a demultiplexer, with the enable as the data input.