Gray Code Converter
Convert between binary and reflected Gray code, either direction.
Binary and Gray code, both ways
Gray code is a binary sequence where each step changes only one bit, which makes it perfect for position encoders and any system where a mid-transition misread would be costly. This tool converts between ordinary binary and reflected Gray code.
The binary 1011 (decimal 11) becomes Gray code 1110, and converting back recovers 1011 and the value 11. Notice how neighbouring numbers in Gray code always differ by a single bit.
Exact and private
It applies the standard XOR conversions in both directions and computes everything in your browser with nothing uploaded.
Frequently Asked Questions
What is Gray code?
A binary ordering where consecutive values differ by exactly one bit. It is used in rotary encoders and error-resistant systems to avoid glitches during transitions.
How is it converted?
Binary to Gray XORs each bit with the bit above it; Gray to binary rebuilds the value by running XOR from the top bit down.
Which direction does the tool go?
Both — enter a binary value to get its Gray code, or a Gray code to recover the binary and decimal value.
Browse the full set of free, private, in-browser tools.