How to Design a Decimal to Binary Encoder

A decimal-to-binary encoder is a digital circuit that converts a decimal number into its binary equivalent. It is also known as a decimal to BCD (binary-coded decimal) encoder, since each decimal digit is represented by a 4-bit binary code. A decimal-to-binary encoder can be used to encode keyboard inputs, display outputs, or perform arithmetic operations in digital systems.

In this article, we will explain the basic principle, design, and applications of a decimal to binary encoder. We will also show how to incorporate content from Bing’s top 5 related pages on the topic, add new sections with headings as needed, and avoid plagiarism by rephrasing and using unique language.

What is an Encoder?

An encoder is a combinational logic circuit that converts a set of inputs into a unique output code. The output code represents the position or identity of the active input. An encoder has 2^n input lines and n output lines, where n is the number of bits in the output code. An encoder can encode 2^n distinct inputs with n bits.

There are different types of encoders, such as priority encoders, which assign a priority to each input and ignore the lower priority inputs when more than one input is active, and binary-weighted encoders, which use a binary weighting system to assign output codes to inputs.

How Does a Decimal to Binary Encoder Work?

A decimal-to-binary encoder usually consists of 10 input lines and 4 output lines. Each input line corresponds to a decimal digit from 0 to 9, and each output line corresponds to a bit in the BCD code.

digital encoder or binary encoder

The encoder accepts one active input at a time and produces the corresponding 4-bit BCD code at the output.

For example, if the input line D3 is active, meaning that the decimal digit 3 is entered, the encoder will produce the BCD code 0011 at the output lines A3, A2 A1 A0. Similarly, if the input line D7 is active, meaning that the decimal digit 7 is entered, the encoder will produce the BCD code 0111 at the output.

The truth table for a decimal-to-binary encoder is shown below:

digital encoder or binary encoder truth table
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0A3 A2 A1 A0
0 0 0 0 0 0 0 0 0 10 0 0 0
0 0 0 0 0 0 0 0 1 00 0 0 1
0 0 0 0 0 0 0 1 0 00 0 1 0
1 1 1 1 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 00000000000000000000

The logical expressions for the output lines can be derived from the truth table using Boolean algebra or Karnaugh maps. For example, the output line A3 will be high only when the input lines D8 or D9 are high, so we can write:

A3 = D8 + D9

Similarly, we can obtain the expressions for A2, A1, and A0:

A2 = D4 + D5 + D6 + D7

A1 = D2 + D3 + D6 + D7

A0 = D1 + D3 + D5 + D7

The logic circuit for decimal to binary encoder can be implemented using OR gates as shown below:

decimal to binary encoder logic circuit

What are Some Applications of Decimal to Binary Encoders?

Decimal to binary encoders are used in various digital systems to encode keyboard inputs, display outputs, or perform arithmetic operations. Some examples are:

  • Keyboard encoders: These are used to convert the keystrokes on a keyboard into binary codes that can be processed by a computer or other devices. For example, a numeric keypad may use a decimal-to-binary encoder to convert the pressed keys into BCD codes that can be sent to a calculator or an ATM machine.
  • Seven-segment display encoders: These are used to convert BCD codes into signals that can drive a seven-segment display.
  • octal to binary encoder
  • A seven-segment display is a device that can display digits from 0 to 9 using seven LED segments arranged in a rectangular shape. Each segment can be turned on or off by applying a voltage across it. To display a digit on a seven-segment display, we need to turn on or off certain segments according to a predefined pattern. For example, to display the digit “5”, we need to turn on segments A, F, G, C, and D; and turn off segments B and E. A seven-segment display encoder can generate these signals from the BCD codes of the digits.
  • Binary adders: These are used to perform the addition of two binary numbers. A binary adder can be constructed using logic gates such as AND, OR, XOR, and NOT.
  • octal to binary encoder truth table
  • To add two BCD numbers, we need to use a special type of binary adder called a BCD adder. A BCD adder can handle the carry-over from one digit to another and correct any invalid BCD results using additional logic circuits.

What are Some Related Topics?

Some related topics that you may want to explore further are:

  • Binary number system: This is a system of representing numbers using only two symbols: “0” and “1”. Each symbol is called a bit (binary digit). Binary numbers can be converted into other number systems such as decimal (base-10), octal (base-8), or hexadecimal (base-16) using simple rules.
  • Decoder: This is a digital circuit that performs the reverse operation of an encoder. It converts an n-bit input code into one of the possible outputs corresponding to that code. For example, a BCD decoder can convert an input BCD code into one of its ten possible outputs representing digits from “0” to “9”.
  • Multiplexer: This is a digital circuit that selects one of several inputs and forwards it to the output based on some control signals. It acts like a switch that connects one of its inputs to its output. For example, an octal multiplexer can select one of its eight inputs based on three control signals.
  • Demultiplexer: This is a digital circuit that distributes one input signal into several outputs based on some control signals. It acts like an inverse switch that connects its input to one of its outputs. For example, an octal demultiplexer can distribute its input signal into one of its eight outputs based on three control signals.


In this article, we have explained how to design a decimal-to-binary encoder using logic gates and truth tables. We have also discussed some applications and related topics of decimal to binary encoders. We hope you have learned something new and useful from this article.

Want To Learn Faster? 🎓
Get electrical articles delivered to your inbox every week.
No credit card required—it’s 100% free.

About Electrical4U

Electrical4U is dedicated to the teaching and sharing of all things related to electrical and electronics engineering.