CS With NehalCS With Nehal

BCD Representation Simulator

Store each denary digit as a 4-bit nibble, compare BCD with pure binary and add BCD numbers with the +6 correction.

Denary → BCD

Each denary digit is stored separately as a 4-bit binary number (a nibble).

2↓
0
0
1
0
9↓
1
0
0
1
5↓
0
1
0
1
0↓
0
0
0
0

00101001 01010000

16
BCD bits
4 digits × 4
12
Pure binary bits
101110000110
2
Bytes used
packed
6
Wasted codes per nibble
1010–1111 never used
BCD uses more bits than pure binary, but each digit converts directly to and from its nibble. This suits things that show denary digits, like calculators, digital clocks and seven-segment displays, and financial values that must not suffer binary rounding errors.

About This Simulation

This BCD simulator shows how Binary Coded Decimal stores each denary digit as its own 4-bit nibble. Convert numbers to and from BCD, compare packed and unpacked storage with pure binary, and step through BCD addition with the add-6 correction.

Features

  • Denary to BCD with each digit converted to a nibble
  • BCD to denary, with invalid nibbles (1010–1111) flagged
  • Packed and unpacked BCD storage
  • Bit and byte comparison with pure binary
  • BCD addition step by step with the +6 correction

Topics covered

  • Binary Coded Decimal
  • Nibbles
  • Packed and Unpacked BCD
  • BCD Addition
  • Uses of BCD

Explanation

Binary Coded Decimal (BCD) represents a denary number by converting each digit separately into a 4-bit binary code. For example, 59 is stored as 0101 1001 rather than 111011 in pure binary. Only the codes 0000 to 1001 are used; 1010 to 1111 are invalid.

How it works

  1. Split the denary number into digits and write each one as 4 bits: 2950 → 0010 1001 0101 0000.
  2. To decode, split the bits into groups of 4 and convert each group to one digit.
  3. Packed BCD stores two digits in each byte; unpacked BCD stores one digit per byte.
  4. To add in BCD, add each nibble in binary. If a nibble's result is more than 9 (or a carry is produced), add 6 (0110) to correct it and carry 1 to the next digit.

Why it matters

BCD is on the IGCSE and AS Level syllabuses. It is used where denary digits must be displayed or must be exact, such as calculators, digital clocks, seven-segment displays and some financial systems, because there are no binary-to-denary rounding errors.

Frequently Asked Questions

What is the BCD representation of 47?

0100 0111: 4 is 0100 and 7 is 0111.

Why does BCD use more bits than binary?

Each 4-bit nibble can hold 16 values but BCD uses only 10 of them, so 6 codes in every nibble are wasted.

Why add 6 in BCD addition?

A nibble can count to 15 but a denary digit only to 9. Adding 6 skips the six unused codes so the nibble wraps round correctly and produces a carry.

Where is BCD used?

Calculators, digital clocks, electronic meters and seven-segment displays, and in financial calculations that need exact denary values.

Related Simulations