No Login Data Private Local Save

Gray Code Converter - Online Binary to Reflected Code

20
0
0
0

Gray Code Converter

Online Binary to Reflected Binary (Gray) Code Converter — Real-time, Step-by-Step

Binary → Gray Code Gray Code → Binary
Input Format:
Quick: 1011 1100 1111 100101
How It Works

Each bit is XORed with the bit to its left. The MSB stays unchanged.

Conversion Result
Enter a value to see the conversion
Gray Code Reference Table (0–15)
Decimal Binary Gray Code Decimal Binary Gray Code

Frequently Asked Questions

What is Gray Code?

Gray Code, also known as Reflected Binary Code, is a binary numeral system where two successive values differ in only one bit. Named after Frank Gray at Bell Labs (1947), it's widely used in digital communications, rotary encoders, and error correction.

How to convert Binary to Gray Code?

The MSB of Gray Code is the same as the MSB of binary. For each subsequent bit, perform XOR between the current binary bit and the previous binary bit: gi = bi ⊕ bi+1.

How to convert Gray Code back to Binary?

The MSB of binary equals the MSB of Gray Code. For each next bit, XOR the Gray Code bit with the previous binary result bit: bi = gi ⊕ bi+1. This cascading XOR uniquely recovers the original binary.

Why is it called "Reflected Binary Code"?

The code is generated by reflecting the previous bit pattern. To create an (n+1)-bit Gray Code, take the n-bit Gray Code, reverse it, prefix the original half with 0 and the reflected half with 1. This mirroring property gives it the "reflected" name.

What are common applications of Gray Code?

Gray Code is used in rotary encoders (position sensors), Karnaugh maps (logic minimization), analog-to-digital converters, error detection, genetic algorithms, and digital communication systems to minimize bit transition errors.

What is the advantage of Gray Code over Binary?

In standard binary, transitioning from 7 (0111) to 8 (1000) flips all 4 bits simultaneously, which can cause glitches. Gray Code ensures only 1 bit changes between any adjacent values, eliminating race conditions and reducing errors in mechanical/electronic systems.