Convert Gray Code to Binary

Convert Gray code to binary instantly with this accurate and user-friendly online converter. Just input your Gray code and get the equivalent binary output in seconds.

Convert Gray Code to Binary

Enter a sequence of Gray codes in the converter to get the corresponding binary representation.

How to Convert Gray Code to Binary

Gray Code to Binary Conversion Formula

There’s a simple method to convert a Gray code number into binary:

  1. The most significant bit (MSB) of the binary number is the same as the MSB of the Gray code.
  2. For the remaining bits:
    • Binary bit = Previous binary bit ⊕ Current Gray bit
      (⊕ = XOR operation)

What is Gray code?

A Gray code is a binary numeral system where two successive values differ by only one bit. Converting Gray code to binary involves a specific algorithm.

Gray Code to Binary Conversion Algorithm:

The most significant bit (MSB) of the binary code is the same as the MSB of the Gray code. Each subsequent binary bit is obtained by XORing the current Gray code bit with the previous binary bit.

Mathematically:

  • Bn=GnBn​=Gn​ (MSB is the same)
  • Bi=Gi⊕Bi+1Bi​=Gi​⊕Bi+1​ for i=n−1i=n−1 down to 00

Truth Table (4-bit Gray Code to Binary)

Below is the truth table for a 4-bit Gray code to binary conversion, along with the conversion steps.

Gray (G₃ G₂ G₁ G₀)Binary (B₃ B₂ B₁ B₀)Conversion Steps
00000000B3=G3=0B3​=G3​=0
B2=G2⊕B3=0⊕0=0B2​=G2​⊕B3​=0⊕0=0
B1=G1⊕B2=0⊕0=0B1​=G1​⊕B2​=0⊕0=0
B0=G0⊕B1=0⊕0=0B0​=G0​⊕B1​=0⊕0=0
00010001B3=0B3​=0
B2=0⊕0=0B2​=0⊕0=0
B1=0⊕0=0B1​=0⊕0=0
B0=1⊕0=1B0​=1⊕0=1
00110010B3=0B3​=0
B2=0⊕0=0B2​=0⊕0=0
B1=1⊕0=1B1​=1⊕0=1
B0=1⊕1=0B0​=1⊕1=0
00100011B3=0B3​=0
B2=0⊕0=0B2​=0⊕0=0
B1=1⊕0=1B1​=1⊕0=1
B0=0⊕1=1B0​=0⊕1=1
01100100B3=0B3​=0
B2=1⊕0=1B2​=1⊕0=1
B1=1⊕1=0B1​=1⊕1=0
B0=0⊕0=0B0​=0⊕0=0
01110101B3=0B3​=0
B2=1⊕0=1B2​=1⊕0=1
B1=1⊕1=0B1​=1⊕1=0
B0=1⊕0=1B0​=1⊕0=1
01010110B3=0B3​=0
B2=1⊕0=1B2​=1⊕0=1
B1=0⊕1=1B1​=0⊕1=1
B0=1⊕1=0B0​=1⊕1=0
01000111B3=0B3​=0
B2=1⊕0=1B2​=1⊕0=1
B1=0⊕1=1B1​=0⊕1=1
B0=0⊕1=1B0​=0⊕1=1
11001000B3=1B3​=1
B2=1⊕1=0B2​=1⊕1=0
B1=0⊕0=0B1​=0⊕0=0
B0=0⊕0=0B0​=0⊕0=0
11011001B3=1B3​=1
B2=1⊕1=0B2​=1⊕1=0
B1=0⊕0=0B1​=0⊕0=0
B0=1⊕0=1B0​=1⊕0=1
11111010B3=1B3​=1
B2=1⊕1=0B2​=1⊕1=0
B1=1⊕0=1B1​=1⊕0=1
B0=1⊕1=0B0​=1⊕1=0
11101011B3=1B3​=1
B2=1⊕1=0B2​=1⊕1=0
B1=1⊕0=1B1​=1⊕0=1
B0=0⊕1=1B0​=0⊕1=1
10101100B3=1B3​=1
B2=0⊕1=1B2​=0⊕1=1
B1=1⊕1=0B1​=1⊕1=0
B0=0⊕0=0B0​=0⊕0=0
10111101B3=1B3​=1
B2=0⊕1=1B2​=0⊕1=1
B1=1⊕1=0B1​=1⊕1=0
B0=1⊕0=1B0​=1⊕0=1
10011110B3=1B3​=1
B2=0⊕1=1B2​=0⊕1=1
B1=0⊕1=1B1​=0⊕1=1
B0=1⊕1=0B0​=1⊕1=0
10001111B3=1B3​=1
B2=0⊕1=1B2​=0⊕1=1
B1=0⊕1=1B1​=0⊕1=1
B0=0⊕1=1B0​=0⊕1=1

Summary:

  • The MSB (B₃) is always the same as G₃.
  • Each subsequent bit is computed as Bi=Gi⊕Bi+1Bi​=Gi​⊕Bi+1​.

This truth table and algorithm can be extended to any number of bits.

Gray Code to Binary Conversion Examples

1. Convert 11100 Gray code to binary?

To convert Gray code 11100 to binary:

  1. First binary bit (MSB) is the same: 1
  2. Next bits:
    • 2nd: 1 ⊕ 1 = 0
    • 3rd: 0 ⊕ 1 = 1
    • 4th: 1 ⊕ 0 = 1
    • 5th: 1 ⊕ 0 = 1

Binary result: 10111

2. Convert 1110 Gray code to binary

To convert Gray code 1110 to binary:

  1. MSB = 1
  2. 2nd: 1 ⊕ 1 = 0
  3. 3rd: 0 ⊕ 1 = 1
  4. 4th: 1 ⊕ 0 = 1

Binary result: 1011

4. What is the binary equivalent of the Gray code 110011?

To convert Gray code 110011 to binary:

  1. MSB = 1
  2. 2nd: 1 ⊕ 1 = 0
  3. 3rd: 0 ⊕ 0 = 0
  4. 4th: 0 ⊕ 0 = 0
  5. 5th: 0 ⊕ 1 = 1
  6. 6th: 1 ⊕ 1 = 0

Binary result: 100010

Also see:

Binary to Gray Code

Binary to Unicode

Binary to ASCII

Binary to BCD

Found this tool helpful? Share Mainconverter with your friends!