# Gray code converters

These online calculators convert to and from the binary reflected in the Gray code and can produce a table for an n-bit Gray code

This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/8648/. Also, please do not modify any references to the original work (if any) contained in this content.

This page combines several calculators related to Gray code. You can read a short recap of what is the Gray code right below the calculators.

First, there is a converter from decimal (to be precise, non-negative integer number) to Gray code (to be precise, binary reflected Gray code):

Second, this is a converter from binary reflected Gray code to decimal, and the result is displayed in decimal and binary formats:

And finally, there is a table generator, which can generate a table for an n-bit Gray code:

### Gray code

The Gray code, named after Frank Gray, is an **ordering** of the binary numeral system, such that two successive values differ in only one bit. The Gray code rolls over the range it represents with only one bit/switch change. I wrote 'switch' because initially, it was designed to prevent spurious output from electromechanical switches in sequential systems. For example, a change from 3 to 4 in normal binary ordering requires three switch changes (from 011 to 100), while in Gray code, we always need only one (from 010 to 110).

The Gray code is also known as the reflected binary code.

## Comments