Home Categories Converters Gray Code to Binary Converter

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.

Quick examples:

Your Gray code input...
Your binary result will appear here...

πŸ“Š Bit-by-Bit Comparison

Position
Gray
Binary

πŸ“ Step-by-Step Breakdown

Final Binary:

πŸ’‘ How to Use This Tool

Convert any Gray code to binary in seconds. Follow these simple steps:

1

Enter Gray Code

Type or paste your Gray code using only 0s and 1s.

2

Click Convert

Press the "Convert to Binary" button or hit Enter to convert.

3

View Results

See the binary result with a bit-by-bit comparison table.

4

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:

  1. Keep the MSB: The most significant bit (MSB) of the binary output is the same as the Gray code MSB
  2. 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

Yes! All conversion happens locally in your browser using JavaScript. Your data never leaves your device and is not sent to any server.
In standard binary, multiple bits can change between consecutive values (e.g., 7β†’8 changes 0111β†’1000). In Gray code, only one bit changes between consecutive values, reducing errors during transitions.
The conversion uses cumulative XOR operations: the MSB stays the same, and each subsequent bit is the XOR of the current Gray code bit and the previous binary bit. For example, Gray 1110 becomes binary 1011.
Gray code decoding is commonly used in rotary encoder systems, ADC output processing, digital communication receivers, and any system that needs to convert Gray-coded data back to standard binary for processing.
Yes! This tool can handle Gray code of any practical length. The JavaScript-based conversion efficiently processes very long sequences.

Version History

1.0.0

Initial release

Jan 24, 2026