← All tools
// Numbers

Gray Code Converter online

Convert between Gray code and binary, decimal, hex, or octal - runs in your browser

Gray Code Converter logo
by
CHUNKY
MUNSTER
// Gray Code Output
Output will appear here...

Using the Gray Code Calculator

  1. Enter a decimal, binary, or hexadecimal value in the input.
  2. Toggle between "convert to Gray code" and "convert from Gray code" modes.
  3. The Gray code and binary representations are shown side by side.
  4. See the bit-by-bit conversion table for the XOR derivation.

Gray Code Converter is a specialized tool for digital engineers and programmers working with reflected binary code. This system, also known as cyclic code, ensures that consecutive values differ by exactly one bit, which is critical in hardware applications like rotary encoders and error correction. This tool provides instant translation between standard binary and Gray code across multiple bases.

Reflected Binary Code in Digital Logic

In a standard binary counter, multiple bits can flip at once, leading to transient errors in physical systems. Using this gray code calculator helps you design more reliable state machines and position sensors by utilizing single-bit transitions. Frank Gray's innovation minimizes ambiguity during mechanical state changes. Whether you need a binary to gray code translation or a back-conversion to decimal, our tool handles the bit-level XOR logic exactly.

Frequently Asked Questions

How do you convert binary to Gray code?

The most significant bit stays the same. Each subsequent bit is XOR'd with the previous binary bit: G[i] = B[i] XOR B[i-1]. Example: binary 1011 → Gray: 1=1, 1 XOR 0=1, 0 XOR 1=1, 1 XOR 1=0 → Gray = 1110.

How do you convert Gray code to binary?

The MSB stays. Each subsequent binary bit is XOR'd with the previous binary bit (not Gray bit): B[i] = G[i] XOR B[i-1]. The process works left to right.

Who invented Gray code?

Frank Gray patented the reflected binary code in 1953 while working at Bell Labs. The "reflected" name comes from the construction method: the sequence is built by taking the n-bit code and appending its mirror image with a leading 1-bit added.

Where is Gray code used outside electronics?

Gray code sequences appear in Hamiltonian paths on hypercube graphs, in puzzles like the Tower of Hanoi (the solution sequence corresponds to Gray code), and in minimising logic expressions using Karnaugh maps.

For related logic tools, check out our Binary to Decimal converter, BCD Converter, and the Bitwise Calculator. Bookmark this page whenever you need a reliable Gray Code Converter.