Free exact browser converter
Octal to BCD Converter
Convert octal integers to 8421 BCD online. Validate digits 0–7, preserve large values with BigInt, and choose grouped or compact BCD output.
Interactive tool
Convert Octal to BCD
Ready
Choose a clear output representation.
Detailed conversion guide
How to Convert Octal to BCD
Read the octal integer in base 8, write its exact decimal value, then encode each decimal digit as four 8421 BCD bits. Octal 73 is 7×8 + 3 = 59; its digits 5 and 9 become 0101 1001.
Grouping each octal digit into three ordinary binary bits gives 111011, which represents the same integer but is not BCD. This converter emits decimal-digit groups instead. BigInt avoids rounding for large octal inputs.
| Input | Output | Meaning |
|---|---|---|
0 | 0000 | zero |
12 | 0001 0000 | decimal 10 |
73 | 0101 1001 | decimal 59 |
377 | 0010 0101 0101 | decimal 255 |
Octal Integer to Decimal-Digit BCD
The algorithm validates the representation before exact integer conversion, so malformed input never produces a plausible partial answer.
const octal = input.trim().replace(/^0o/i, "").replace(/[\s_]/g, "");
if (!/^[0-7]+$/.test(octal)) throw Error("Invalid octal");
const digits = BigInt("0o" + octal).toString(10);
const bcd = [...digits].map(d => (+d).toString(2).padStart(4, "0")).join(" ");Octal Digits, Leading Zeros, and BCD Groups
Digits 8 and 9, signs, fractions, repeated prefixes, and commas are rejected. Spaces and underscores join one integer: 7 3 means octal 73, not two separate values.
Numeric leading zeros do not add decimal digit groups; octal 00073 produces the same BCD as 73. Zero produces 0000. Compact BCD must be read in four-bit groups. Signed packed BCD and excess-3 are unsupported.
Related converters
Continue with exact representation converters
Choose a converter for the formats you are working with.