Our Decimal to Gray Code Converter helps you instantly compute any non-negative decimal number into its corresponding Gray code value.
Decimal to Gray Code Converter
How to Convert Decimal to Gray Code
Many users search for how to convert decimal to gray code manually. The process is straightforward once you understand the formula.
Step 1: Convert Decimal to Binary
First, convert the decimal number into its binary equivalent.
Step 2: Apply the Gray Code Formula
Gray Code Formula:
Gray = Decimal XOR (Decimal >> 1)
Example
Let’s convert Decimal 10 to Gray code.
Step 1: Convert to Binary
10 in binary = 1010
Step 2: Apply XOR Rule
Binary: 1 0 1 0
Shifted: 0 1 0 1
XOR Result: 1 1 1 1
Gray Code = 1111
Decimal to Gray Code Table
Below is a quick reference decimal to gray code table for the first 16 numbers:
| Decimal | Gray Code |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0011 |
| 3 | 0010 |
| 4 | 0110 |
| 5 | 0111 |
| 6 | 0101 |
| 7 | 0100 |
| 8 | 1100 |
| 9 | 1101 |
| 10 | 1111 |
| 11 | 1110 |
| 12 | 1010 |
| 13 | 1011 |
| 14 | 1001 |
| 15 | 1000 |
This pattern continues following the one-bit change rule.
Why Use an Online Decimal to Gray Code Converter?
Manual conversion can be time-consuming and error-prone, especially with larger numbers.
Using an online tool:
- Eliminates calculation errors
- Provides instant results
- Saves time
- Works for any non-negative integer
- Requires no binary knowledge
Simply enter a decimal number and get the Gray code immediately.
Related conversions: