About Gray Code to Binary
Gray Code to Binary converts a Gray-coded value back into ordinary binary. Gray code is the sequence where consecutive numbers differ by a single bit, used in rotary encoders and error-prone signalling, and this tool performs the standard shift-and-xor conversion that recovers the original binary number.
Type a string of ones and zeros and the tool parses it as binary, then applies the conversion - the running value is xor-ed with the Gray code shifted right repeatedly until the code is exhausted. The sample of 1111 in Gray code reads 1010 in binary.
The input must be pure binary digits, and there is no support for hex or separators. Surrounding whitespace is trimmed, but a value with an internal space fails, and a non-binary string parses to NaN and prints the literal NaN rather than an error. The conversion is one direction only - turning binary back into Gray code is left to the matching encode tool.
How to use Gray Code to Binary
- 1 Type or paste the Gray-coded binary value.
- 2 Read the result as it updates - the binary equivalent appears as a string.
- 3 Keep the input to ones and zeros; anything else parses to NaN.
Frequently asked questions
How is Gray code converted back to binary?
By the standard shift-and-xor method: the running value is xor-ed with the Gray code shifted right one bit at a time until the code is exhausted. The Gray value 1111 becomes binary 1010.
What input format does it expect?
Pure binary digits with no separators. Surrounding whitespace is trimmed, but a value such as 1111 1111 with an internal space fails, and there is no hexadecimal or prefix support.
What happens with a non-binary input?
It parses to NaN and the tool prints the literal NaN, with no error message explaining that the input was not valid binary.
Does it convert binary back to Gray code too?
No. This direction recovers binary from Gray code only. To go the other way you need the separate encode tool.
Free, online, and private
Free to use
Gray Code to Binary is completely free. There is no account to create, no login, and no hidden charge or usage limit.
Runs online in your browser
It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.
Your data stays private
All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.
How Gray Code to Binary behaves in detail
These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.
| Parameter | Value |
|---|---|
| Input | one text panel, recalculated live on every keystroke; the sample reads 1111 |
| Parsing | the input is trimmed and read as a binary number |
| Algorithm | the standard shift-and-xor conversion - the running value is xor-ed with the Gray code shifted right repeatedly |
| Output | the result as a binary string |
| Default | 1111 in Gray code reads 1010 in binary |
| Invalid input | text that is not binary parses to NaN and prints the literal NaN |
Compiled from the implementation of this tool and checked against it by itoolnet.
What Gray Code to Binary does not do
Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.
- The input must be pure binary digits. There is no hexadecimal, no separator handling and no prefix support - a value like 1111 1111 with a space fails, and the surrounding whitespace is trimmed but nothing else is tolerated.
- Invalid input is not reported as an error. A non-binary string parses to NaN and the tool prints the literal NaN, with no message explaining that the input was not valid binary.
- The conversion is one direction only. To turn binary into Gray code you need the matching encode tool, and there is no option to preserve leading zeros in the output beyond what the conversion produces.
Tested and documented by itoolnet, the team that builds and maintains this site.