Gray code to binary converter
Enter a Gray code reading from an encoder or an exercise to get the binary number and decimal value it stands for.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter gray code.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
The first binary bit equals the first Gray bit, and each later binary bit is the XOR of the previous binary bit and the Gray bit in the same position.
Example
Inputs: Gray code = 1110. Result: Binary number: 1011.
1110
1011
Limits and caveats
- Assumes the standard binary-reflected Gray code.
- Keeps the bit width you typed, including leading zeros.
Questions about this tool
How do I convert Gray 1110 to binary?
First bit 1, then 1 XOR 1 = 0, 0 XOR 1 = 1, 1 XOR 0 = 1, giving 1011, which is 11 in decimal.
Is this the exact reverse of binary to Gray?
Yes. Converting the result back to Gray code gives the original reading.
Can I type bits with spaces?
Yes. Spaces and underscores are ignored, so 1110 0101 works.
