Binary Coded Decimal (BCD) is a way of representing decimal numbers in binary where each individual decimal digit is encoded separately using exactly four bits, rather than converting the whole number into a single binary value. The decimal number 95, for example, becomes 1001 0101 in BCD — nine as 1001, five as 0101 — side by side.

What is the difference between BCD and pure binary?

In pure binary, the entire decimal number is converted to a single binary number:

95 in pure binary = 64 + 16 + 8 + 4 + 2 + 1 = 1011111 (7 bits)

In BCD, each decimal digit is converted independently to 4-bit binary:

Decimal digit 4-bit BCD code
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

So 95 in BCD = 1001 0101 (8 bits: 4 for the 9, 4 for the 5).

Notice that BCD uses 8 bits to store what pure binary represents in 7 bits. BCD is less storage-efficient — but it has other advantages that make it valuable in specific contexts.

Why use BCD? The precision advantage

The critical advantage of BCD is that it avoids the rounding errors introduced by binary floating point.

Consider calculating £14.99 + £0.01 on a computer using standard binary floating point:

>>> 14.99 + 0.01
15.000000000000002    # floating point rounding error

The error is tiny but unacceptable in financial applications — a bank cannot round up your balance by 0.000000000000002p. BCD sidesteps this because it stores each digit exactly as typed; there is no conversion between decimal and binary that could introduce an approximation.

This is why financial software, tax systems, and point-of-sale terminals often use BCD or a decimal-based arithmetic library rather than standard floating point.

A worked encoding example

Encode 327 in BCD:

Decimal digit BCD group
3 0011
2 0010
7 0111

327 in BCD = 0011 0010 0111 (12 bits)

327 in pure binary = 256 + 64 + 4 + 2 + 1 = 101000111 (9 bits)

Decode 0110 1000 from BCD:

  • First group: 0110 = 6
  • Second group: 1000 = 8

Result: 68

What are the wasted bit patterns in BCD?

Four bits can represent 16 different values (0000 through 1111, i.e. 0–15). BCD only uses 10 of those 16 patterns (0000–1001, representing digits 0–9). The remaining six patterns (1010 through 1111, representing 10–15 in pure binary) are illegal in BCD — they should never appear in valid BCD data.

Bit pattern Pure binary value BCD status
0000–1001 0–9 Valid BCD digits
1010 10 Illegal in BCD
1011 11 Illegal in BCD
1100 12 Illegal in BCD
1101 13 Illegal in BCD
1110 14 Illegal in BCD
1111 15 Illegal in BCD

This waste of 6 out of 16 bit patterns per digit means BCD requires more bits (and more storage) than pure binary for large numbers.

Where is BCD used in real systems?

  • Digital clocks and watches: The seven-segment display driver circuits that show digits are naturally suited to BCD — each digit on the display is driven directly from one BCD group.
  • Calculators: Early calculators used BCD arithmetic to display exact decimal results without floating point errors.
  • Financial and banking systems: Currencies require exact decimal arithmetic; BCD avoids the rounding errors inherent in binary floating point.
  • COBOL programs: The COBOL programming language, still widely used in banks and government systems, has built-in support for packed decimal (a compact form of BCD).

Advantages and disadvantages of BCD

Advantage Disadvantage
No conversion errors — exact decimal representation Less storage-efficient than pure binary
Easy to display on decimal digit outputs Arithmetic circuits are more complex
Straightforward to convert to/from human-readable decimal Slower arithmetic than native binary
Avoids floating point rounding in financial arithmetic 6 bit patterns per group are wasted

Frequently asked questions

Is BCD the same as ASCII or Unicode?

No. ASCII and Unicode encode characters (letters, digits, symbols) as binary numbers for storage and communication. BCD encodes decimal digits (0–9) for arithmetic purposes. The ASCII code for the digit character '5' is 00110101 (53 in decimal) — quite different from the BCD code for the number 5, which is just 0101.

How does BCD handle negative numbers?

Standard BCD (as described above) only represents non-negative integers. Extensions exist: packed BCD uses the final nibble as a sign indicator (1100 for positive, 1101 for negative). Financial arithmetic systems typically handle signs separately from the digit encoding.

Why is BCD still relevant when we have high-precision floating point libraries?

BCD remains relevant because it is the simplest way to guarantee exact decimal arithmetic without software overhead. Hardware BCD circuits in calculators and clock chips are cheap and reliable. In embedded systems with limited resources, a hardware BCD counter is far simpler than a floating point arithmetic unit. Conceptually, BCD is also an important illustration of the idea that there are multiple ways to represent numbers in binary — a core GCSE data representation principle.

How much storage does BCD use compared to pure binary?

For an n-digit decimal number, BCD uses 4n bits. Pure binary uses approximately log₂(10ⁿ) ≈ 3.32n bits — roughly 17% less. For the number 9,999,999 (7 digits), BCD needs 28 bits and pure binary needs 24 bits (since 2²³ < 9,999,999 < 2²⁴). The storage overhead grows with the number of digits, making BCD impractical for very large numbers where storage efficiency matters.


Professor Turing at aitutors.me will walk you through BCD encoding and decoding with step-by-step practice questions until the digit groups feel as natural as decimal.