TOP

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.

No signupFree online conversion

Interactive tool

Convert Gray Code to Binary

Ready

Output format

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.

InputOutputMeaning
00zero boundary
11one boundary
11111010exact conversion
00110010exact 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

Choose the exact conversion direction you need.

Advertisement

Sponsored link