Skip to content
D DocNectar

Free Gray Code Converter

Convert between standard binary and Gray code in either direction.

100% Free No Signup Works on all devices

Built and fact-checked by the DocNectar team — see our editorial standards

Thanks for rating!

Key Features

Instant Calculation

Get accurate results in real time with our optimized algorithm.

Mobile Friendly

Fully responsive design. Works on all devices & screen sizes.

Privacy Focused

Your data stays on your device. We don't store any inputs.

100% Free

No hidden costs. This tool is completely free forever.

Gray code is a binary numbering system where two consecutive values differ in only one bit, which prevents errors in applications like rotary encoders where multiple bits could otherwise change at slightly different times.

This calculator converts between standard binary and Gray code in either direction.

How it works

Choose a direction and enter a binary value. Converting to Gray code XORs the binary number with itself shifted one bit right. Converting back to binary folds the bits left to right, XOR-ing each bit with the previous result.

  1. Enter direction.
  2. Enter value (binary digits).
  3. Click Calculate to see your results.

Examples

Binary 1011 to Gray

The binary number 1011 converts to the Gray code 1110.

Who should use it

  • Understanding rotary encoder and digital hardware design.
  • Coursework involving digital logic and error-correcting codes.

Industry applications

  • Digital electronics and hardware design
  • Computer science education

Advantages

  • Reduces errors from multi-bit transitions in hardware and communication systems.
  • Works in both directions from a single tool.

Limitations

  • Less intuitive to read directly as a numeric value than standard binary.

Common mistakes to avoid

  • Entering a decimal number instead of a binary string — this tool expects binary digits (0s and 1s) as input.
  • Confusing Gray code with binary-coded decimal (BCD), which is a different encoding scheme entirely.

Best practices

  • When converting a series of sequential values, verify that each consecutive pair of Gray code results differs by exactly one bit — that's the defining property of Gray code.

Tips

  • To see the "adjacent values differ by one bit" property in action, convert a short run of consecutive binary numbers (000, 001, 010, 011...) to Gray code and compare each result to the one before it.

Frequently asked questions

Yes, with no signup and no limit on how many conversions you run.
Because only one bit changes between consecutive values, it reduces the risk of misreadings in hardware like rotary encoders and reduces errors in certain digital communication and error-correction schemes.
Yes — this tool pads the Gray code result to match the input's bit length so no leading-zero information is lost.
No — they're different systems. BCD represents each decimal digit separately in 4-bit binary groups, while Gray code is a full reordering of binary values so adjacent values differ by one bit.

Get new calculators and guides in your inbox

No spam — just new tools like Gray Code Converter and practical guides.

Favorites