Free browser converter
Gray Code to Binary Converter
Convert reflected binary Gray code to ordinary binary online with cumulative XOR, exact BigInt arithmetic, preserved bit width, strict validation, and 0b output.
Interactive tool
Convert Gray Code to Binary
Ready
Choose an explicit output representation.
Detailed conversion guide
How to Convert Gray Code to Binary
Copy the first Gray bit. Each following binary bit is the XOR of the previous binary bit and the current Gray bit.
For Gray 1111, cumulative XOR produces ordinary binary 1010. The converter preserves the entered bit width, including meaningful leading zeros.
| Input | Output | Meaning |
|---|---|---|
0 | 0 | zero boundary |
1 | 1 | one boundary |
1111 | 1010 | exact conversion |
0011 | 0010 | exact conversion |
Gray Code to Binary with Cumulative XOR
Cumulative XOR reverses reflected Gray code exactly; padding restores the validated input width for bit-level work.
let binary = gray;
for (let shift = gray >> 1n; shift; shift >>= 1n) binary ^= shift;
const bits = binary.toString(2).padStart(width, '0');Ordinary Binary vs Reflected Gray Code
Gray code and ordinary binary are different bit representations of the same non-negative integer. This page performs that exact direction only.
Only 0 and 1 are allowed. Leading zeros are preserved in ordinary binary output because bit width can matter in hardware and test vectors.
Related converters
Continue with related data converters
Choose the exact conversion direction you need.