Binary Coded Decimal (BCD) is a class of binary encoding scheme where each decimal digit is represented by a fixed number of binary bits — most commonly 4 bits per digit. The decimal number 45 becomes 0100 0101 in 4-bit BCD. BCD is widely used in systems that display decimal numbers directly, such as digital clocks, cash registers, and calculators.
In standard BCD (also called 8421 BCD), each decimal digit 0–9 is represented as its 4-bit binary equivalent. For example: 0 = 0000, 5 = 0101, 9 = 1001. The digits 1010 through 1111 (10–15 in binary) are invalid in BCD and must never appear. Multi-digit numbers are represented by concatenating the 4-bit groups for each digit.
8421 BCD is the most common BCD format. The weights of the four bits in each group are 8, 4, 2, and 1 — matching standard binary bit weights.
BCD avoids the rounding errors inherent in IEEE 754 binary floating-point. Financial calculations require exact decimal representation — e.g., $0.10 cannot be represented exactly in binary.