Math & Number Utilities100% Client-Side

Decode Gray Code to Binary

Paste a reflected Gray code bit string to recover its ordinary binary representation. The most significant bit stays the same, and each following binary bit depends on the Gray bit and the binary bit already decoded to its left. The converter keeps the width of the source Gray field. This is useful for comparing fixed-width examples that use two encodings of the same non-negative value.

Input
6 chars•1 lines
Output

Reverse tool

Binary to Gray Code Converter

Convert non-negative binary integers to reflected Gray code. Preserve input bit width and check the one-bit changes between consecutive values.

Open Binary to Gray Code Converter
Example input
101010
Example output
111111

How to Use the Gray Code to Binary Converter Online

  1. 1Paste the unsigned Gray bit field as one value, keeping any leading zeroes that belong to it.
  2. 2Check that the field uses binary-reflected Gray code before comparing the result.
  3. 3Read the decoded value shown in binary. Save that base with the expected result.
  4. 4Copy the output alongside the original Gray field when the test needs to show which encoding supplied the value.

Input & Output Examples

The magnitude is 42 in decimal, so the displayed result is its binary representation.

Input Sample
111111
Expected Output
101010

The four Gray bits decode to four binary bits. Keeping the leading zero preserves the field width.

Input Sample
0b0_101
Expected Output
0110

Practical Developer Workflows

  • Decode a reflected Gray field for comparison with a known binary fixture.
  • Check the running relationship between Gray bits and binary bits in a lesson.
  • Verify that leading zeroes remain visible in a fixed-width example.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

Copy the first Gray bit as your first binary bit. For each later position, XOR the incoming Gray bit with the previous decoded binary bit. If they differ, write a one, and if they match, write zero.

Explore Other Tools

12 suggested tools

View all tools