Free browser converter
BCD to Decimal Converter
Decode complete four-bit 8421 BCD groups to decimal digits while preserving leading zeros and rejecting the six invalid binary nibbles.
Interactive tool
Decode 8421 BCD groups to decimal digits
Ready
Choose the exact data representation; the tool never guesses an encoding.
Detailed conversion guide
How to Convert BCD to Decimal Digits
Split the input into four-bit nibbles and decode each nibble independently. 0100 is digit 4 and 0010 is digit 2, so 0100 0010 becomes 42.
BCD uses only ten of the sixteen possible nibbles. Values 1010 through 1111 are invalid and produce an error instead of being treated as decimal 10 through 15.
| Input | Output | Meaning |
|---|---|---|
0000 | 0 | valid digit |
0101 | 5 | valid digit |
1001 | 9 | highest valid digit |
1010 | invalid | not a decimal digit |
Validate Every BCD Nibble
Check the bit count, split into groups of four, reject values above nine, and join the decoded digits as text so leading zeros survive.
const groups = bits.match(/.{4}/g);
const values = groups.map((group) => Number.parseInt(group, 2));
if (values.some((value) => value > 9)) throw new Error("Invalid BCD");
const decimalDigits = values.join("");Invalid Nibbles, Group Width, and Leading Zeros
Every group must contain exactly four bits. Compact input is accepted only when its total length is a multiple of four.
The result is a digit string rather than a mathematical number, so 0000 0100 0010 correctly returns 042 instead of dropping the leading zero.
Related converters
Continue with related data converters
Choose the converter for the exact direction and representation you need.