We are very familiar with this term encoder, mainly encoding and decoding. But to understand encoding we have to know first what an encoder is? So start with an *encoder we should know that it *is basically a multiplexer without its single output line. You may follow my previous post on **Multiplexer** to know encoder better way. An encoder is work with combinational logic function and it has 2^{n }input lines and n output lines, which correspond to n selection lines in a multiplexer. Now another question is come on our mind that what is the use of an encoder? Encoder basically generates an output for a particular combination of input bits.

The n output lines generate the binary code for the possible 2^{n} input lines. Let us take an example of an octal-to-binary encoder. As we know an encoder would have eight input lines, each representing an octal digit, and three output lines representing the three-bit binary equivalent. Now see in bellow simple logic diagram we can easily understand that when we put 8 bit number to an octal number d0-d7 it will activate corresponding equivalent three-bit binary number.

The eight input lines would have 2^{8} = 256 possible combinations. However, in the case of an octal-to-binary encoder, only eight of these 256 combinations would have any meaning. The remaining combinations of input variables are ‘don’t care’ input combinations. Also, only one of the input lines at a time is in logic ‘1’ state. The above figure shows the hardware implementation of the octal-to-binary encoder described by the truth table in Table. This circuit has the shortcoming that it produces an all 0s output sequence when all input lines are in logic ‘0’ state. This can be overcome by having an additional line to indicate an all 0s input sequence.