Gray Code Converter

Convert binary to Gray code or Gray code to binary, with a step-by-step bit transformation table.

Input

Quick examples

Enter a binary or Gray code value to see the conversion.

Copied!

Summary

Convert binary to Gray code or Gray code to binary, with a step-by-step bit transformation table.

How it works

  1. Enter a binary number (e.g. 1011) or a Gray code sequence in the input box.
  2. Choose the conversion direction: Binary → Gray or Gray → Binary.
  3. The tool applies the XOR rule bit by bit to produce the output.
  4. A step-by-step table shows each bit position, the input bit, the XOR operation, and the output bit.
  5. The decimal value of both the input and output is shown for reference.

Use cases

  • Verify Gray code assignments for rotary encoders in embedded systems.
  • Debug digital circuits that use Gray code to eliminate glitches.
  • Study the relationship between binary and reflected binary (Gray) code.
  • Convert Karnaugh map cell addresses when laying out logic expressions.
  • Generate Gray code sequences for teaching digital logic courses.

Frequently Asked Questions

Last updated: 2026-07-01 · Reviewed by Nham Vu