Binary Coded Decimal to Decimal Converter
Convert BCD (Binary Coded Decimal) to decimal numbers instantly. Validates nibbles, detects invalid BCD codes, and shows step-by-step conversion.
About
Binary Coded Decimal (BCD) encodes each decimal digit as a separate 4-bit binary nibble. A raw binary-to-decimal conversion treats the entire bitstream as one positional value. BCD does not. Each nibble is independent. This distinction matters in financial systems, digital clocks, and legacy mainframe architectures where decimal precision is non-negotiable. A nibble value exceeding 10012 (910) is an invalid BCD code and signals data corruption or encoding error. This tool parses your BCD input nibble-by-nibble, flags any invalid codes with their exact position, and concatenates valid digits into the final decimal result.
Assumption: input represents unsigned, packed BCD (no sign nibble). Unpacked BCD (8 bits per digit, upper nibble zeroed) should be entered as space-separated nibbles. The tool left-pads the final leftmost group with zeros if fewer than 4 bits remain. Pro tip: if you are reading BCD from a hardware register, confirm byte order (big-endian vs. little-endian) before entering bits here.
Formulas
Each BCD nibble is converted independently using positional binary weighting:
where b3b2b1b0 are the 4 bits of the nibble (MSB to LSB) and d is the resulting decimal digit. The validity constraint is:
The full decimal number is the concatenation of all nibble results read left to right:
where || denotes string concatenation (not addition). D = final decimal output. n = total number of nibbles.
Reference Data
| Decimal Digit | BCD Nibble | Binary Value | Hex | Valid BCD |
|---|---|---|---|---|
| 0 | 0000 | 0 | 0x0 | ✓ |
| 1 | 0001 | 1 | 0x1 | ✓ |
| 2 | 0010 | 2 | 0x2 | ✓ |
| 3 | 0011 | 3 | 0x3 | ✓ |
| 4 | 0100 | 4 | 0x4 | ✓ |
| 5 | 0101 | 5 | 0x5 | ✓ |
| 6 | 0110 | 6 | 0x6 | ✓ |
| 7 | 0111 | 7 | 0x7 | ✓ |
| 8 | 1000 | 8 | 0x8 | ✓ |
| 9 | 1001 | 9 | 0x9 | ✓ |
| 10 | 1010 | 10 | 0xA | ✗ Invalid |
| 11 | 1011 | 11 | 0xB | ✗ Invalid |
| 12 | 1100 | 12 | 0xC | ✗ Invalid |
| 13 | 1101 | 13 | 0xD | ✗ Invalid |
| 14 | 1110 | 14 | 0xE | ✗ Invalid |
| 15 | 1111 | 15 | 0xF | ✗ Invalid |