Binary To Gray Code
Reverse Conversion
How This Converter Works
Encodes a binary word as reflected binary Gray code, preserving its width.
Formula or rule
The first Gray bit equals the first binary bit; each later Gray bit is the XOR of adjacent binary bits, equivalent to n XOR (n shifted right by 1).
Example
- Input
- 101101
- Calculation
- Copy 1; adjacent XORs are 1⊕0=1, 0⊕1=1, 1⊕1=0, 1⊕0=1, 0⊕1=1.
- Result
- 111011