Gray Code Converter
Convert between binary and Gray code, and read the full reflected code table for a chosen bit width.
Convert binary and Gray code
Converted: —
How to use the Gray Code Converter
- Pick the direction you want to convert in.
- Choose the bit width and type the binary value.
- Read the converted code and the reflected table below.
Features
- Binary to Gray code and back
- Any width from 2 to 16 bits
- Full reflected code table up to 8 bits
- Highlights the conversion as you type
Advertisement
Frequently Asked Questions
Common questions about the free online gray code converter.
Gray code is an ordering of bit patterns where consecutive values differ in exactly one bit,
which reduces switching errors.
Keep the leading bit, then take the exclusive or of each pair of neighbouring binary bits to
produce the Gray digits.
Copy the leading bit, then exclusive or each new binary bit with the next Gray bit to rebuild
the binary value.
The table is built by reflecting and inverting the previous block, and below the leading bit
that is the same Gray bit it repeats exactly.
It appears in rotary encoders, Karnaugh maps, error correction and mechanical position
sensors.
Yes. Padding to a wider width adds leading zeros and changes the Gray digits, so match the
width of your hardware.
A full table grows as two to the power of the width, and 8 bits already gives 256 rows, which
is plenty to read.
No. Gray code is a one to one mapping, so every binary value has exactly one Gray partner.
No. It holds the same information but in a different order that changes only one bit at a
time.
Yes. The converter runs entirely in your browser, costs nothing and needs no sign-up.
Last updated: October 10, 2026