Math & Number Utilities100% Client-Side

Encode a Decimal Value as Gray Code

Paste a base-ten whole number to get its reflected Gray encoding as bits. The converter reads the decimal value exactly, then uses its binary magnitude to calculate the Gray code. It returns the shortest ordinary Gray spelling for that value. This is useful when building a sequence table from consecutive decimal values or preparing an example that needs a known Gray representation.

Input
2 chars•1 lines
Output

Reverse tool

Gray Code to Decimal Converter

Decode an unsigned reflected Gray code and display its exact decimal value. Read a non-negative base-ten result for an exercise or test fixture.

Open Gray Code to Decimal Converter
Example input
111111
Example output
42

How to Use the Decimal to Gray Code Converter Online

  1. 1Paste one non-negative integer written in decimal.
  2. 2Check the ordinary binary magnitude if you are comparing against a hand-worked example.
  3. 3Read the resulting reflected Gray bits. Confirm the expected width before copying them.
  4. 4Use the matching reverse converter to compare the restored value with the original input.

Input & Output Examples

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

Input Sample
42
Expected Output
111111

Decimal 15 becomes binary 1111. The Gray transform produces 1000, without the padding of the decimal source.

Input Sample
000_15
Expected Output
1000

Practical Developer Workflows

  • Create a short table that pairs decimal values with Gray codes for a lesson.
  • Encode a test fixture whose source value is written in base ten.
  • Compare the output for two consecutive decimal values after aligning their bit widths.

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

Write the value in binary, shift that binary value one place right, and XOR the two. For decimal 42 the binary value is 101010 and its shifted value is 010101. Their XOR gives Gray 111111.

Explore Other Tools

12 suggested tools

View all tools