BCD to Decimal Converter
Convert Binary-Coded Decimal (BCD) to decimal numbers instantly. Supports 8421 BCD with step-by-step nibble breakdown and validation.
| # | Nibble | Calculation | Digit | Status |
|---|
About
Binary-Coded Decimal (BCD) encodes each decimal digit independently into a fixed-length 4-bit binary nibble using the 8421 weighting scheme. Unlike standard binary, BCD does not treat the entire number as a single base-2 value. A misread nibble or an invalid code (any value from 1010 to 1111) produces a fault in hardware decoders and financial computing systems that rely on exact decimal representation. This converter validates each nibble against the legal BCD range 0000 - 1001, flags invalid codes with their bit position, and outputs the concatenated decimal result. It assumes unsigned, integer BCD with no sign nibble. For packed BCD formats used in COBOL, IBM mainframes, and fiscal registers, enter consecutive nibbles without separators.
Formulas
Each 4-bit BCD nibble b3b2b1b0 converts to its decimal digit d using positional bit weights:
For a multi-digit BCD number consisting of n nibbles, the full decimal value D is formed by concatenation, not arithmetic summation:
Validity constraint for each nibble: d ≤ 9. Any nibble yielding d ≥ 10 is an illegal BCD code.
Where b3, b2, b1, b0 = individual bits of the nibble (most significant to least significant). d = decoded decimal digit (0 - 9). n = total number of nibbles. D = final decimal output.
Reference Data
| Decimal Digit | BCD (8421) | Bit Weight Calculation |
|---|---|---|
| 0 | 0000 | 0×8 + 0×4 + 0×2 + 0×1 = 0 |
| 1 | 0001 | 0×8 + 0×4 + 0×2 + 1×1 = 1 |
| 2 | 0010 | 0×8 + 0×4 + 1×2 + 0×1 = 2 |
| 3 | 0011 | 0×8 + 0×4 + 1×2 + 1×1 = 3 |
| 4 | 0100 | 0×8 + 1×4 + 0×2 + 0×1 = 4 |
| 5 | 0101 | 0×8 + 1×4 + 0×2 + 1×1 = 5 |
| 6 | 0110 | 0×8 + 1×4 + 1×2 + 0×1 = 6 |
| 7 | 0111 | 0×8 + 1×4 + 1×2 + 1×1 = 7 |
| 8 | 1000 | 1×8 + 0×4 + 0×2 + 0×1 = 8 |
| 9 | 1001 | 1×8 + 0×4 + 0×2 + 1×1 = 9 |
| Values below are invalid in standard 8421 BCD | ||
| INVALID | 1010 | Decimal 10 - exceeds single digit range |
| INVALID | 1011 | Decimal 11 - exceeds single digit range |
| INVALID | 1100 | Decimal 12 - exceeds single digit range |
| INVALID | 1101 | Decimal 13 - exceeds single digit range |
| INVALID | 1110 | Decimal 14 - exceeds single digit range |
| INVALID | 1111 | Decimal 15 - exceeds single digit range |