Binary Coded Decimal (BCD) is a binary-encoded representation of decimal numbers where each decimal digit is represented by its own fixed-length binary sequence. The most common BCD format is the 8421 BCD, in which each decimal digit 0-9 is encoded as a four-bit binary number from 0000 to 1001. Codes from 1010 to 1111 are unused (invalid) in standard BCD.
BCD is widely used in digital systems that interface with humans or decimal displays, for example digital clocks, calculators, meters and numeric displays, because it preserves decimal digit boundaries and simplifies decimal arithmetic and display driving.
There are two standard approaches to convert a binary integer into BCD:
Procedure:
Overview:
This algorithm maps naturally to combinational/sequential hardware and avoids an explicit decimal-conversion step.
Example 1: (11110)2
First convert the binary to decimal.
Binary number: (11110)2
Compute the decimal equivalent:
1 × 2⁴
+ 1 × 2³
+ 1 × 2²
+ 1 × 2¹
+ 0 × 2⁰
= 16
+ 8
+ 4
+ 2
= 30

Now convert the decimal number 30 into BCD by encoding each decimal digit.
Decimal digits: 3 and 0
3 in 4-bit BCD = 0011
0 in 4-bit BCD = 0000
Concatenate the nibbles: 0011 0000

Result:
(11110)2 = (00110000)BCD
When implementing binary→BCD conversion in combinational logic, one can derive Boolean expressions for each BCD output bit as functions of the binary input bits. A truth table that lists the BCD outputs for each binary input value (up to the required range) is used to derive Sum-of-Products (SOP) expressions which can be simplified by Karnaugh maps (K-maps).

From such a table one may write SOP expressions for the BCD bits. These expressions are then simplified using K-maps to obtain minimal logic. The following placeholders indicate where such SOP expressions and K-maps would appear.






Conversion from BCD to binary is the reverse process. Typical approaches are:
Example 1: (00101000)BCD
Convert BCD to decimal by making four-bit groups.
Group the 8 bits into two nibbles:
High nibble = 0010
Low nibble = 1000

Decode each nibble to decimal:
0010 (BCD) = 2
1000 (BCD) = 8
Combined decimal number = 28
Convert the decimal 28 to binary.
Divide 28 by 2 and record remainders (long division method):
28 ÷ 2 = 14 remainder 0
14 ÷ 2 = 7 remainder 0
7 ÷ 2 = 3 remainder 1
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1

Arrange the remainders from last to first to form the binary number.
Binary = 11100
Result:
(00101000)BCD = (11100)2
Standard 4-bit BCD encodings only permit 0000 to 1001. Codes 1010-1111 are invalid and may indicate an error or overflow. Detection logic can be implemented that flags any nibble with bit pattern greater than 1001. A common detection method is to test if (B3 & (B2 | B1)) | (B3 & B2 & B1) - simpler Boolean forms can be derived and implemented.
BCD encodes each decimal digit into a 4-bit group (most commonly 8421 BCD). Converting binary ↔ BCD may be done by using an intermediate decimal representation or by direct algorithms suitable for hardware (shift-and-add-3). The examples above demonstrate both directions: (11110)2 → 30 → 0011 0000 (BCD), and (00101000)BCD → 2 8 → 28 → 111002. For practical digital designs, attention must be paid to invalid BCD patterns and to correction logic required when performing decimal arithmetic in BCD.
![]() | Explore Courses for Electronics and Communication Engineering (ECE) exam |
![]() | Get EduRev Notes directly in your Google search |