# Difference between encoder and decoder

In this article, we will discuss the difference between encoder and decoder. Both are combinational logic circuits. A combinational logic circuit is a circuit that contains different types of logic gates. There are n numbers of inputs, and m numbers of outputs are possible in a combinational logic circuit.

The basic difference between encoder and decoder is that, in encoder, the binary information is passed in the form of 2n input lines, and it changes the input into n output lines. Whereas, in decoder, the binary information is passed in the form of n input lines, and changes this binary information in the form of 2n output lines. Similarly, we will see other differences between encoder and decoder.

But before jumping directly to the comparison, let's first see a brief description of encoder and decoder.

## Encoder

An encoder can also be described as a combinational circuit that has a maximum of 2^n (or less) input lines and n output lines.

Encoders are used to convert a decimal number into a binary number. The objective is to perform a binary operation such as addition, subtraction, multiplication, etc. The basic logic element that is used in encoders is OR gate. The operation of the encoder is fairly simple. Encoders are commonly used in Videos, E-mail, etc.

The representation of the encoder is shown in the below image - There are various types of encoders such as 4 to 2 line encoder, 8 to 3 line encoder, etc.

In 4 to 2 line encoder, there are a total of four inputs, i.e., Y0, Y1, Y2, and Y3, and two outputs, i.e., A0 and A1.

In 8 to 3 line encoder, there are a total of eight inputs, i.e., Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7 and three outputs, i.e., A0, A1, and A2. It is also known as Octal to Binary Encoder.

## Decoder

Decode performs the reverse operation of encoder.

It can be described as a combinational circuit that converts binary information from n coded inputs to a maximum of 2^n different outputs. In decoder, the basic logic element is AND gate along with the NOT gate. Decoders are commonly used in memory chips, microprocessors, etc. Unlike encoder, the operation of decoder is complex. It is because the decoder requires understanding the coding format of the encoder.

The representation of the decoder is shown in the below image - There are various types of decoders such as 2 to 4 line decoder, 3 to 8 line decoder, etc.

In the 2 to 4 line decoder, there are a total of three inputs, i.e., A0, A1, and E and four outputs, i.e., Y0, Y1, Y2, and Y3.

In 3 to 8 line decoder, there are a total of eight outputs, i.e., Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7 and three inputs, i.e., A0, A1, and A2. It is also called as Binary to octal decoder.

The commonly used or most preferred decoders are n to m decoders, where m<= 2^n. It is also referred to as n * m decoder that has n inputs and m outputs.

## Encoder v/s Decoder Now, let's see the comparison between Encoder and Decoder. We are comparing both terms on the basis of some characteristics to make the comparison clear and more understandable.

S.no. On the basis of Encoder Decoder
1. Basic It is a combinational circuit that basically converts the information signal to the coded digital bitstream. It is also a combinational circuit that converts the coded bits to the original information. It performs the reverse operation of the encoder.
2. Input lines There are 2n input lines in the encoder. There are n input lines in the decoder.
3. Output lines There are n output lines in the encoder. There are 2n output lines in the decoder.
4. Operation The operation of the encoder is fairly simple. Unlike encoder, the operation of decoder is complex.
5. Basic logic element The basic logic element that is used in encoders is OR gate. In decoder, the basic logic element is AND gate along with the NOT gate.
6. Installation It is installed at the transmitting end. It is installed at the receiving side.
7. Application Encoders are commonly used in Videos, E-mail, etc. Decoders are commonly used in memory chips, microprocessors, etc.

Both encoders and decoders are the compliment of each other. One is used for encoding the original information, and another is used to decode the coded data bits to get the exact message signal.

So, that's all about the article. Hope it will be helpful and informative to you.

Next TopicDifference between

### Feedback   