---
title: "Encoder and octal-to-binary (8-to-3) encoder"
subject: "Digital Logic"
chapter: 4
key: "semester_3/digital_logic:octal-to-binary-encoder"
source: https://www.bctengineer.com/q/semester_3/digital_logic/octal-to-binary-encoder
site: BCT Engineering
---

# Encoder and octal-to-binary (8-to-3) encoder

Digital Logic · Chapter 4: Data Processing Circuits

- Asked in: 2079 Bhadra, 1+5 marks; 2074 Asoj, 1+4 marks (asked 2 times)
- Video: [Encoder in Digital Electronics | Working, Application and Logic Circuit of Encoder](https://www.youtube.com/watch?v=NWiPVMDh7GE) — ALL ABOUT ELECTRONICS
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/digital_logic/octal-to-binary-encoder
- Whole chapter: https://www.bctengineer.com/md/semester_3/digital_logic/chapter-4

## Question

What is an encoder? Explain 8 to 3 line encoder with circuit diagram and truth table.

## Short answer

An encoder converts one active input into its binary code. The 8-to-3 encoder assumes exactly one input high; outputs are A2 = D4+D5+D6+D7, A1 = D2+D3+D6+D7, A0 = D1+D3+D5+D7. D0 is inferred when all outputs are 0; a valid bit resolves the ambiguity.

## Answer

An **encoder** is a combinational circuit that converts an active signal on one of its $2^n$ (or fewer) input lines into an n-bit binary code. It does the reverse of a decoder.

#### 8-to-3 line (octal-to-binary) encoder

It has 8 inputs $D_0$–$D_7$ (one per octal digit) and 3 outputs $A_2A_1A_0$. It is assumed that only one input is 1 at any time.

| $D_0$ | $D_1$ | $D_2$ | $D_3$ | $D_4$ | $D_5$ | $D_6$ | $D_7$ | $A_2$ | $A_1$ | $A_0$ |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |

#### Output expressions

Each output is the OR of the inputs whose code has a 1 in that bit:
$$
\begin{aligned} A_2 &= D_4 + D_5 + D_6 + D_7 \\ A_1 &= D_2 + D_3 + D_6 + D_7 \\ A_0 &= D_1 + D_3 + D_5 + D_7 \end{aligned}
$$

#### Circuit diagram

```text
 D0 D1 D2 D3 D4 D5 D6 D7
  │  │  │  │  │  │  │  │
  x  │  │  │  ├──┼──┼──┼──[OR]── A2  (D4,D5,D6,D7)
     │  ├──┼──┼──┼──┼──┼──[OR]── A1  (D2,D3,D6,D7)
     ├──┼──┼──┼──┼──┼──┼──[OR]── A0  (D1,D3,D5,D7)
```

Three 4-input OR gates are enough; $D_0$ is not connected (no output bit is 1 for it).

**Limitations**

- If no input is active, the output is 000, the same as for $D_0$; a valid-output line is needed to tell them apart.
- If two inputs are active together, the output is wrong (e.g. $D_3$ and $D_5$ give $011 + 101 = 111$, which reads as 7). A **priority encoder** solves this by encoding only the highest active input.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which equation gives A0 for the 8-to-3 encoder?
   A. D1 + D3 + D5 + D7
   B. D4 + D5 + D6 + D7
   C. D2 + D3 + D6 + D7
   D. D0 + D2 + D4 + D6
   Answer: A. A0 is 1 for the codes with LSB = 1, namely 1, 3, 5 and 7. (Key point: Output equation)

2. What problem does the output 000 create?
   A. Both D0 active and no input active give 000
   B. It damages the encoder
   C. It means D7 is active
   D. It indicates two inputs active
   Answer: A. D0 has no OR gate input, so a valid-output line is needed to tell the two cases apart. (Key point: Limitation with no input)

3. If D3 and D5 are active together, what is the output?
   A. 011
   B. 101
   C. 111
   D. 110
   Answer: C. The ORs combine 011 and 101 into 111, giving a wrong result; a priority encoder avoids this. (Key point: Two inputs active)

## Related in Digital Logic

- [Octal-to-binary encoder; A+B'C canonical form](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Aoctal-binary-encoder-canonical) — Digital Logic, chapter 4
- [Octal priority encoder design](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Aoctal-priority-encoder-design) — Digital Logic, chapter 4, asked 3×
- [Priority encoder and octal priority encoder](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Aoctal-priority-encoder) — Digital Logic, chapter 4, asked 3×
- [Convert octal 623.77 to decimal, binary, hex](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Aconvert-octal-623-77) — Digital Logic, chapter 1
- [Gray code and 3-bit binary-to-Gray converter](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Agray-code-binary-gray-converter) — Digital Logic, chapter 1
- [SR flip-flop diagram, excitation table, equation](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Asr-flipflop-diagram-equation) — Digital Logic, chapter 6

## Related in other subjects

- [Encoder; NAND and XOR truth tables](https://www.bctengineer.com/question.md?key=semester_2%2Fbasic_electronics_engineering%3Aencoder-truth-tables) — Basic Electronics Engineering, chapter 6
- [JK flip-flop operation and truth table](https://www.bctengineer.com/question.md?key=semester_2%2Fbasic_electronics_engineering%3Ajk-flip-flop) — Basic Electronics Engineering, chapter 6
- [Stereo FM encoder and decoder block diagram](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Astereo-fm-encoder-decoder-blocks) — Communication Systems, chapter 3
- [Short note: Trellis diagram of convolutional encoder](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ashort-note-trellis-1010-half-rate) — Communication Systems, chapter 8
