An encoder is a combinational circuit that performs reverse function of a decoder. It accepts 2n input and produces output in n output lines. This process of generating codes based on the values of input lines is called encoding.

4 to 2 Line Encoder
A 4 to 2 line encoder consists of 4 input lines and 2 output lines. When any of the input lines becomes 1, we get corresponding binary at the output lines.

Truth table of 4 to 2 line encoder is,
Input | Output | ||||
---|---|---|---|---|---|
Y3 | Y2 | Y1 | Y0 | A1 | A0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | 1 |
0 | 1 | 0 | 0 | 1 | 0 |
1 | 0 | 0 | 0 | 1 | 1 |
From the truth table, we can find logic expressions for A0 and A1 as following,
The circuit diagram for a 4 to 2 line encoder is shown below,

Octal to Binary Encoder
An 8 to 3 line encoder or octal to binary encoder consists of 8 input lines and 3 output lines. When any of the input lines becomes 1, we get corresponding binary at the output lines.

Truth table of 8 to 3 line encoder is,
Inputs | Output | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Y7 | Y6 | Y5 | Y4 | Y3 | Y2 | Y1 | Y0 | A2 | A1 | A0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
From the truth table, we can find logic expressions for A0, A1 and A2 as following,
The circuit diagram for a 8 to 3 line encoder is shown below,
