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

4-to-1 multiplexer using 2-to-1 multiplexers, live

A 4-to-1 multiplexer can be built from three 2-to-1 multiplexers in a tree: two muxes on the first level use S0 to pick D0 or D1 and D2 or D3, and a third mux uses S1 to pick between their outputs. The output is Y = D(S1 S0), exactly like a single 4-to-1 mux.

The select bits split the job: the low bit S0 chooses within each pair of inputs and the high bit S1 chooses which pair wins. The same trick scales: an 8-to-1 mux is two 4-to-1 muxes plus one 2-to-1 mux on S2, or seven 2-to-1 muxes in three levels, and in general a 2^n-to-1 mux takes 2^n - 1 two-input muxes. Each MUX block here is the gate-level 2-to-1 multiplexer saved as a part; open the circuit in the lab to look inside. Compare the flat 4-to-1 multiplexer from AND and OR gates and the 8-to-1 multiplexer. All 64 combinations of data and select inputs are checked before the page is built.

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 D0 to D3, S1 and S0, three 2-to-1 multiplexers, and a probe Y.
  2. First mux: D0 and D1 with select S0. Second mux: D2 and D3 with select S0.
  3. Third mux: the outputs of the first two, with select S1. Its output is Y.
  4. Set a pattern on D0 to D3 and count S1 S0 from 00 to 11: Y shows D0, D1, D2, D3 in turn.

4-to-1 multiplexer truth table

S1S0First level picksY
00D0 (and D2)D0
01D1 (and D3)D1
10D0 (and D2)D2
11D1 (and D3)D3

Both first-level muxes switch together on S0; S1 only decides which of their two outputs reaches Y.

You can also read the full theory in the lesson on the multiplexer. 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 gates1-to-8 demultiplexerexcess-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 decoderXOR gate from NOR gates

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 4-to-1 mux from 2-to-1 muxes in the lab →

Frequently asked

How many 2-to-1 muxes make a 4-to-1 mux?

Three: two on the first level, selected by S0, and one on the second level, selected by S1.

How do you build an 8-to-1 mux from 4-to-1 muxes?

Use two 4-to-1 muxes for D0 to D3 and D4 to D7, both selected by S1 S0, and one 2-to-1 mux on S2 to pick between them.

How many 2-to-1 muxes make an 8-to-1 mux?

Seven, in three levels of four, two and one. A 2^n-to-1 mux always takes 2^n - 1 two-input muxes.

Is a mux tree slower than a single multiplexer?

Each level adds a mux delay, so a tree of n levels is slower than one flat n-select mux of AND and OR gates, but it is easy to build from standard parts and to extend.