TOP

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.

No signupRuns locally in your browser

Interactive tool

Convert Gray Code to BCD

Ready

Output format

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.

InputOutputMeaning
00000decimal 0
10001decimal 1
11110001 0000decimal 10
1001100101 1001decimal 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

Use one canonical page for the precise input and output direction you need.

Advertisement

Sponsored link