Maths & numbers

Binary reflected Gray code calculator

Convert unsigned words between ordinary binary and reflected Gray encoding.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Convert unsigned words between ordinary binary and reflected Gray encoding.

THE FORMULAEncode with n XOR (n shifted right once). Decode by cumulative XOR.

A worked example

Binary 111 encodes as Gray 100, and Gray 100 decodes back to 111.

Good to know

Both input fields accept the integer represented by the word.

Read the result

Convert unsigned words between ordinary binary and reflected Gray encoding.

The primary result is labeled “Encoded Gray word”. Keep the input definitions in view when comparing this result with another method.

Try a related calculation

Both input fields accept the integer represented by the word.

For a related exercise, try the greatest common divisor.

A few questions, answered

How can I check the default inputs by hand?

Binary 111 encodes as Gray 100, and Gray 100 decodes back to 111.

Which rule does this calculator apply?

Encode with n XOR (n shifted right once). Decode by cumulative XOR.

Find your calculator

Start typing to explore the library.