TOP

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.

No signupFree online conversion

Interactive tool

Decode 8421 BCD groups to decimal digits

Ready

Mode and output format

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.

InputOutputMeaning
00000valid digit
01015valid digit
10019highest valid digit
1010invalidnot 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

Choose the converter for the exact direction and representation you need.

Advertisement

Sponsored link