Free exact browser converter
Gray Code to BCD Converter
Decode reflected binary Gray code and convert the exact integer to validated 8421 BCD groups online, with strict bit checks and BigInt precision.
Interactive tool
Convert Gray Code to BCD
Ready
Choose a clear output representation.
Detailed conversion guide
How to Convert Gray Code to BCD
Reverse reflected Gray encoding with cumulative XOR to recover the exact integer, write that integer in decimal, then map each decimal digit to one four-bit 8421 BCD group.
Gray 1111 decodes to binary 1010 and decimal 10. Its two decimal digits become BCD 0001 0000; the boundary between those nibbles is significant.
| Input | Output | Meaning |
|---|---|---|
0 | 0000 | decimal 0 |
1 | 0001 | decimal 1 |
1111 | 0001 0000 | decimal 10 |
100110 | 0101 1001 | decimal 59 |
Gray Decode followed by Decimal-Digit BCD
The algorithm validates the representation before exact integer conversion, so malformed input never produces a plausible partial answer.
let binary = gray;
for (let s = gray >> 1n; s; s >>= 1n) binary ^= s;
const bcd = [...binary.toString()].map(d => (+d).toString(2).padStart(4,'0'));Reflected Gray Input and BCD Group Boundaries
Only reflected binary Gray code is supported. Invalid bits, signs, and fractions are rejected rather than silently removed.
Compact BCD is reversible only when read in four-bit groups. This page does not emit packed signed BCD, excess-3, or DPD.
Related converters
Continue with exact representation converters
Use one canonical page for the precise input and output direction you need.