Gray Code to Binary Converter
Convert Gray code to binary numbers instantly. Perfect for digital electronics engineers, computer science students, and hardware designers working with reflected binary code decoding.
π Bit-by-Bit Comparison
| Position | |
|---|---|
| Gray | |
| Binary |
π Step-by-Step Breakdown
π‘ How to Use This Tool
Convert any Gray code to binary in seconds. Follow these simple steps:
Enter Gray Code
Type or paste your Gray code using only 0s and 1s.
Click Convert
Press the "Convert to Binary" button or hit Enter to convert.
View Results
See the binary result with a bit-by-bit comparison table.
Explore Steps
Enable "Show step-by-step breakdown" to see the XOR operations.
π About Gray Code to Binary Converter
What is Gray Code?
Gray code, also known as reflected binary code (RBC), is a special binary encoding where two successive values differ in only one bit. Converting Gray code back to standard binary is essential for decoding rotary encoder readings and processing data from systems that use Gray code encoding.
How Gray Code to Binary Conversion Works
The conversion uses XOR operations in a cumulative manner:
- Keep the MSB: The most significant bit (MSB) of the binary output is the same as the Gray code MSB
- Cumulative XOR: Each subsequent binary bit is the XOR of the current Gray code bit and the previous binary bit
Formula: B[i] = G[i] XOR B[i-1] (where B[n] = G[n] for MSB)
Example: Gray 1110 β Binary 1011
- B[3] = G[3] = 1
- B[2] = G[2] XOR B[3] = 1 XOR 1 = 0
- B[1] = G[1] XOR B[2] = 1 XOR 0 = 1
- B[0] = G[0] XOR B[1] = 0 XOR 1 = 1
Common Use Cases
- Rotary Encoder Decoding: Converting absolute position readings to standard binary
- Digital Logic Design: Reverse-engineering Karnaugh map outputs
- Data Recovery: Decoding Gray-coded signals in communication systems
- ADC Output Processing: Converting Gray-coded ADC outputs to binary
- Embedded Systems: Processing sensor data encoded in Gray code
- Educational Purposes: Understanding digital encoding schemes
Privacy & Security
This tool runs entirely in your browser using JavaScript. Your data is never sent to any serverβall conversion happens locally on your device.
Technical Details
- Supports any length Gray code input
- Validates input for proper binary format (0s and 1s only)
- Real-time conversion as you type
- Shows both Gray code and binary with bit-by-bit comparison
- Includes conversion steps visualization
β Frequently Asked Questions
Version History
Initial release
Jan 24, 2026