How does Encoder work in Digital Electronics? In this tutorial, we will discuss this concept. An Encoder is a **combinational circuit** that achieves the opposite process of Decoder. It has a maximum of 2^n input lines and ‘n’ output lines at a time, only one input line is activated for ease. The procedure of converting from symbols or numbers to coded format is called encoding.

There are two main **types** of digital encoders. The Binary **Encoder** and the Priority **Encoder**. We have seen that the Binary **Encoder** converts one of 2^{n} inputs into an n-bit output. Then a binary **encoder** has fewer output bits than the input code.

These are normally used in communication systems such as telecommunication, networking, etc. to transfer data from one end to the other end. Below is a block diagram of the encoder in which there are many inputs and N number of outputs means fewer numbers of output than inputs.

There are many types of digital encoders in which we discuss two main types .

## 4 to 2 line Encoder in Digital Electronics.

The 4 to 2 Encoder consists of **four inputs Y3, Y2, Y1 & Y0,** and two outputs A1 & A0. At any time, only one of these 4 inputs can be activated ‘1’ in order to get the individual binary code at the output. The figure below shows the logic symbol of 4 to 2 Encoder

Four inputs generates two outputs, means when we input four numbers of inputs then encoder gives us only two numbers of outputs, in below A1 and A0 are outputs.

Now a days every digital circuits encoders are used.

Below is truth table of 4 to 2 Encoder, in which when Y3 is one and others inputs are zeros then A1 and A0 both are zeros. And when Y2 is one then A0 is one. And Y1 is one then A1 is one. And when Y0 is one then A1 and A0 both are ones.

We can inverse the truth table like below. In which Y0 is zero then A1 and A0 are zeros. And When Y1 is one then A0 is one. Like this when we give Y2 one signal then A1 gives one. And when Y3 is one then both A1 and A0 are ones.

#### Fundamental Logic Gates with truth tables

Below is a circuit diagram of 4 to 2 Encoder in which two OR Gates are used.

## 8 to 3 line Encoder in Digital Electronics.

The 8 to 3 Encoder or octal to Binary encoder consists of **8 inputs means **Y7 to Y0 and 3 outputs: A2, A1 & A0. Each input line corresponds to each octal digit and three outputs generate corresponding binary code.

Below is symbol of Octal to Binary Encoder.

Below is truth table of 8 to 3 Encoders. In which we can see that when Y0 is one then A0,A1,A2 all are zeros. When Y7 is one then all A0,A1 and A2 are ones.

Below is Circuit diagram of 8 to 2 Encoder in which three OR Gates are used which outputs are A0,A1 and A2