Free Online Tool

Gray Code

Convert between binary and Gray code representations.

How to Use Gray Code

  1. Enter a value (text, decimal, or binary depending on the mode).
  2. It is converted to Gray code, where consecutive values differ by exactly one bit.
  3. Switch mode to convert Gray code back to binary/decimal.
  4. Copy the result. The conversion runs in your browser.

Gray code keeps only one bit changing between adjacent numbers, which prevents glitches in rotary encoders and reduces errors when signals change.

Examples

Decimal 2 → Gray — input:

010 (binary of 2)

Output:

011

Decimal 3 → Gray — input:

011 (binary of 3)

Output:

010

Decimal 4 → Gray — input:

100 (binary of 4)

Output:

110

The first bit is copied; each following Gray bit is the XOR of two adjacent binary bits.

Features

Privacy Focused

All processing happens in your browser. No data is sent to servers.

Free Forever

No registration, no limits, completely free to use.