101010 from Binary to Gray Code

Converting a binary number to Gray code involves performing a bitwise exclusive OR (XOR) operation between each pair of adjacent bits in the binary representation. Here's a step-by-step guide with an example for binary number 101010:

Step 1: Write Down the First Bit of the Gray Code

Write down the first bit of the Gray code as the same as the first bit of the binary number.

FIRST BIT OF GRAY CODE: 1

Step 2: perform the XOR operation of the first and the second bits of the binary number

The 1st bit is 1, and the 2nd bit is 0. Both the bits are different, so the second bit of the Gray code is 1.

Step 3: perform the XOR operation of the second and the third bits of the binary number

The 2nd bit is 0, and the 3rd bit is 1. Both the bits are different, so the third bit of the Gray code is 1.

Step 4: perform the XOR operation of the third and the fourth bits of the binary number

The 3rd bit is 1, and the 4th bit is 0. Both the bits are different, so the fourth bit of the Gray code is 1.

Step 5: perform the XOR operation of the fourth and the fifth bits of the binary number

The 4th bit is 0, and the 5th bit is 1. Both the bits are different, so the fifth bit of the Gray code is 1.

Step 6: perform the XOR operation of the fifth and the sixth bits of the binary number

The 5th bit is 1, and the 6th bit is 0. Both the bits are different, so the sixth bit of the Gray code is 1.

So, the Gray code for the binary number101010 is 111111.
Binary To Gray Code Converter



Other examples of Binary To Gray Code conversion