All labs › Learn › Digital Logic Design
All articlesAll labs

Multiplexer and Demultiplexer: The 74151 and 74138

Learn how a multiplexer selects one of many inputs, how the 74151 works, how to build a Boolean function with it, and how a demultiplexer sends data out.

Updated 28 November 2026 · 4 min read · Designed by Fasih Ullah Saleem

01A selector switch for data02The 7415103A function generator04Fewer select lines than variables05The demultiplexer06Checking a circuit07Worked example with four variables08Try it in the virtual lab09Questions and answers10Related topics
01

A selector switch for data

A multiplexer, or MUX, is a digital switch that connects one of several inputs to a single output. A binary number on the select lines decides which one. An 8 to 1 multiplexer has eight data inputs, D0 to D7, three select lines and one output. If the select lines read 101, the output copies D5.

Multiplexers share one wire between many signals. A time multiplexed display, a computer bus and a telephone exchange use them.

Y = D0 · S2' S1' S0' + D1 · S2' S1' S0 + D2 · S2' S1 S0' + ... + D7 · S2 S1 S0
02

The 74151

The 74151 is an 8 to 1 multiplexer in a 16 pin package. Pin 16 is the supply and pin 8 is ground. Its data inputs are D0 to D7 and the select inputs are A, B and C, where C is the most significant bit. The enable input G is active low. When G is high, the output Y is forced low. The chip provides both Y and its complement W.

GC B AY
1x x x0
00 0 0D0
00 0 1D1
01 0 1D5
01 1 1D7
03

A function generator

A multiplexer can build any Boolean function. Connect the variables to the select lines. Connect each data input to 0 or 1 according to the truth table of the function. The multiplexer then looks up the answer.

Example: the sum of a full adder is 1 for the input codes 1, 2, 4 and 7. Use the three inputs as selects. Connect D1, D2, D4 and D7 to logic 1 and the others to logic 0. The carry out is 1 for the codes 3, 5, 6 and 7, so a second multiplexer needs D3, D5, D6 and D7 at logic 1.

04

Fewer select lines than variables

You can build a function of four variables with an 8 to 1 multiplexer. Use three variables as the select lines. For each select code, look at the two rows of the truth table that differ only in the fourth variable D. The data input is then 0, 1, D or D'.

  • If the output is 0 in both rows, the data input is 0.
  • If the output is 1 in both rows, the data input is 1.
  • If the output equals D, connect the input to D.
  • If the output equals the opposite of D, connect the input to D' through an inverter.

This halves the number of data inputs needed, so a 4 variable function fits in one chip. The same method uses a 4 to 1 multiplexer for a 3 variable function.

05

The demultiplexer

A demultiplexer does the reverse. It takes one data input and sends it to one of several outputs, chosen by the select lines. A decoder with an enable input is one. With a 74138, put the data on the enable pin G2A and the address on A, B and C. The selected output follows the data. All other outputs stay at 1.

A multiplexer at one end of a wire and a demultiplexer at the other end, driven by the same select code, carry many signals over a single line. This is time division multiplexing.

06

Checking a circuit

Test a multiplexer by setting each data input to a distinct pattern. Hold the select lines at one code and toggle the data inputs, to confirm that only the selected input changes the output. Then change the select code through all eight values. A broken select line shows up as pairs of inputs that cannot be separated.

07

Worked example with four variables

Build F(A, B, C, D) = Σ m(0, 1, 4, 7, 9, 10, 15) with an 8 to 1 multiplexer. Use the variables A, B and C as the select lines, with A the most significant, so the select value is k = 4A + 2B + C. On the chip itself the most significant select pin is called C, so variable A goes to chip pin C. Each pair of rows with the same ABC holds the minterms 2k and 2k + 1.

Select ABCMinterms presentData input
000 (D0)0 and 11
001 (D1)none0
010 (D2)4 onlyD'
011 (D3)7 onlyD
100 (D4)9 onlyD
101 (D5)10 onlyD'
110 (D6)none0
111 (D7)15 onlyD

One inverter makes D' for the two inputs that need it. The whole function is then one multiplexer chip and one inverter, where a gate version would take many more gates.

08

Try it in the virtual lab

SinBench has free 3D benches and interactive demos for this topic. Open one to try the ideas above with real instruments, no sign up needed.

Lab 10

Multiplexer and Demultiplexer (74151, 74138)

Open the lab →Concepts and demos
09

Questions and answers

What does a multiplexer do?

It connects one of several data inputs to a single output. The select lines choose which input is passed.

How do you implement a Boolean function with a multiplexer?

Use the variables as select lines and connect each data input to 0 or 1 following the truth table. The multiplexer then gives the right output for each input code.

Can an 8 to 1 multiplexer implement a 4 variable function?

Yes. Use three variables as selects and connect each data input to 0, 1, the fourth variable or its complement.

How do you make a demultiplexer from a 74138?

Put the data on an active low enable pin and the address on the select inputs. The chosen output follows the data and the others stay high.

10

Related topics

Digital Logic Design

3-to-8 Line Decoder: How the 74138 Works

Learn how a 3 to 8 line decoder works, the 74138 enable pins and active low outputs, how to build any function from minterms, and expand to 4 to 16 lines.

Digital Logic Design

Encoders and the 74148 Priority Encoder

Learn how encoders and priority encoders work. See the 74148 inputs, active low outputs, the GS and EO signals, and how to cascade two chips to encode 16 lines.

Digital Logic Design

Karnaugh Maps: Simplify Boolean Functions Step by Step

A step by step guide to Karnaugh maps: how to fill a 4 variable map, group cells, use don't cares and write the simplest sum of products, with a worked example.

SinBench SinBench · Free virtual labsDesigned by Fasih Ullah Saleem
© 2026 Fasih Ullah Saleem. All rights reserved. fasihullahsaleem.com · About · Terms of Use · Privacy