A multiplexer (MUX) is a device that allows digital information from several sources to be routed onto a single line for transmission over that line to a common destination.
The basic multiplexer has several data-input lines and a single output line.
It also has data-select inputs, which permit digital data on any one of the inputs to be switched to the output line.
A 2-bit code on the data-select (S) inputs will allow the data on the selected data input to pass through to the data output.
If a binary 0 (S1=0 and S0=0) is applied to the data-select lines, the data on input D0 appear on the data-output line.
If a binary 1 (S1=0 and S0=1) is applied to the data-select lines, the data on input D1 appear on the data output.
If a binary 2 (S1=1 and S0=0) is applied, the data on D2 appear on the output.
If a binary 3 (S1=1 and S0=1) is applied, the data on D3 are switched to the output line.