Convert Gray code (reflected binary) to standard binary with step-by-bit XOR operations
Input Gray Code
Result
Binary
Step-by-Step Derivation
Gray to Binary Principle
Binary₀ = Gray₀ (MSB copy)
Binary₁ = Binary₀ XOR Gray₁
Binary₂ = Binary₁ XOR Gray₂
Binaryₙ = Binaryₙ₋₁ XOR Grayₙ
Gray to binary conversion: copy the MSB, then each subsequent bit is previous binary bit XOR current Gray bit.
⚠Gray code must contain only 0s and 1s. No other characters allowed.
What Is Gray Code?
Gray code (reflected binary code) is a binary numeral system where consecutive values differ by exactly one bit. This minimizes errors during transitions between states.
Single Bit Change
Consecutive numbers differ by exactly one bit. This prevents ambiguous intermediate states.
Conversion Method
MSB copies directly. Each next bit = previous binary bit XOR current Gray bit.
Karnaugh Maps
Gray code ordering simplifies K-map simplification by grouping adjacent cells.
Error Minimization
Only one bit changes, so sensors and encoders can't produce ambiguous intermediate states.
Gray code (reflected binary code) is a binary numeral system where consecutive values differ by exactly one bit. This minimizes errors during transitions between states.
How do you convert Gray code to binary?▼
1. The leftmost bit of binary = leftmost bit of Gray. 2. Each subsequent binary bit = previous binary bit XOR current Gray bit. 3. Continue until all bits are processed.
Why is Gray code used?▼
Gray code is used where only one bit changes at a time: rotary encoders, position sensors, error correction, Karnaugh maps, communication systems, and digital logic design.
What is the difference between binary and Gray code?▼
In binary, multiple bits can change between consecutive numbers (e.g., 3→4: 011→100). In Gray code, only one bit changes. This prevents ambiguous intermediate states during transitions.
Free online calculators and tools covering mathematics, unit conversion, text processing, and daily life. Accurate, fast, mobile-friendly, and completely free to use.