- Home
- Tools
- Math
- Gray Code Conversion
- Binary To Gray Code Converter

### You must be logged in to perform this action.

#### Use another service to log in.

# Binary to Gray Code Converter

###### **Updated:** Sep 19, 2018

Binary to Gray Code Converter is used to convert a Binary number into Gray Code format. Use the

Gray Code Converter tool to convert between any number base and gray code.

Thank You for trying our tools. If you liked our tools please give a thumbs up to our Facebook page and share it with your friends.

The following tools may help you instead.

× We have noted the error and will address it soon. Send us a feedback with your email address if you want to be notified. `Ctrl` + `Alt` + `H` | Open this Help |

`Ctrl` + `Alt` + `Shift` + `S` | Configure Global Settings |

`Ctrl` + `Alt` + `Enter` | Convert (**Submit**) |

`Ctrl` + `Alt` + `Backspace` | Clear Output |

`Ctrl` + `Alt` + `Shift` + `F` | Fullscreen Input |

`Ctrl` + `Alt` + `F` | Fullscreen Output |

`Ctrl` + `Alt` + `D` | Download Output |

`Ctrl` + `Alt` + `C` | Copy Output |

`Ctrl` + `Alt` + `U` | Focus URL Textbox |

`Enter` (inside URL text box) | Load URL |

`Ctrl` + `Alt` + `L` | Load Input File |

`Ctrl` + `Alt` + `E` | Load Example |

`Ctrl` + `Alt` + `I` | Focus Input Editor |

`Ctrl` + `Alt` + `O` | Focus Output Editor |

`Ctrl` + `Alt` + `Shift` + `Up` | Expand All Output |

`Ctrl` + `Alt` + `Shift` + `Down` | Collapse All Output |

`Ctrl` + `Alt` + `W` | Open **With Output** Menu |

**Output:** Gray Code numbers

### Conversion from Binary to Gray Code

A Binary can be converted to Gray Code in three steps:-

Take the first bit of the binary input and write it to the output

Repeat the following steps until you reach the end of the input

Take the second bit of the input and XOR it to the previous bit of the input

Write this result to the output. So, `0 + 0 = 0`

, `0 + 1 = 1`

, `1 + 0 = 1`

and `1 + 1 = 0`

.

#### Example Binary to Gray Code Conversion

Let's say your Binary value is `10101101`

and you want to convert it to it's Gray Code form.

**Step 1: ** Take the first bit of the binary input and write it to the output. Output is **1**

**Step 2: ** Repeat the steps below until you reach the end of the input- Take the second bit of the input and XOR it to the previous bit of the input.
`1 + 0 = 1`

- Write the result to the output. Output:
`1`**1**

- Take the third bit of the input and XOR it to the previous bit of the input.
`0 + 1 = 1`

- Write the result to the output. Output:
`11`**1**

- Take the fourth bit of the input and XOR it to the previous bit of the input.
`1 + 0 = 1`

- Write the result to the output. Output:
`111`**1**

- Take the fifth bit of the input and XOR it to the previous bit of the input.
`0 + 1 = 1`

- Write the result to the output. Output:
`1111`**1**

- Take the sixth bit of the input and XOR it to the previous bit of the input.
`1 + 1 = 0`

- Write the result to the output. Output:
`11111`**0**

- Take the seventh bit of the input and XOR it to the previous bit.
`1 + 0 = 1`

- Write the result to the output. Output:
`111110`**1**

- Take the eighth (last) bit of the input and XOR it to the previous bit.
`0 + 1 = 1`

- Write the result to the output. Output:
`1111101`**1**

**Step 3: ** So, our final gray code result is: `11111011`

### Gray Code Table

Decimal | Hex | Binary | Gray Code |
---|

0 | 0 | 0000 | 0000 |

1 | 1 | 0001 | 0001 |

2 | 2 | 0010 | 0011 |

3 | 3 | 0011 | 0010 |

4 | 4 | 0100 | 0110 |

5 | 5 | 0101 | 0111 |

6 | 6 | 0110 | 0101 |

7 | 7 | 0111 | 0100 |

8 | 8 | 1000 | 1100 |

9 | 9 | 1001 | 1101 |

10 | a | 1010 | 1111 |

11 | b | 1011 | 1110 |

12 | c | 1100 | 1010 |

13 | d | 1101 | 1011 |

14 | e | 1110 | 1001 |

15 | f | 1111 | 1000 |

### History

**Created: ** Feb 5, 2018

** Online Tool Designed For: ** Windows, OS X, Android, iOS, Linux

This website uses cookies to ensure you get the best experience. By using our site, you agree to its use of cookies. Learn more