Decimal to Gray code
Type a value in dec to get it in Gray instantly.
10000000Gray
That's about the same as a byte. That needs 8 bits to store.
Convert the other way: Gray to dec
What it means
How big is that?
Whole numbers only. Anything after the decimal point is rounded away.
The math
How to convert dec to Gray
Base b: each digit is worth b times the one to its right. Gray code = n XOR (n ÷ 2); BCD writes each decimal digit as four bits.
Example: 255 dec = 10000000 Gray.
Every unit
Your number in every base
Tables
dec to Gray conversion table
| dec | Gray |
|---|---|
| 1 dec | 1 Gray |
| 2 dec | 11 Gray |
| 4 dec | 110 Gray |
| 8 dec | 1100 Gray |
| 10 dec | 1111 Gray |
| 15 dec | 1000 Gray |
| 16 dec | 11000 Gray |
| 31 dec | 10000 Gray |
| 32 dec | 110000 Gray |
| 64 dec | 1100000 Gray |
| 100 dec | 1010110 Gray |
| 128 dec | 11000000 Gray |
| 255 dec | 10000000 Gray |
| 256 dec | 110000000 Gray |
| 512 dec | 1100000000 Gray |
| 1,000 dec | 1000011100 Gray |
| 1,024 dec | 11000000000 Gray |
Gray to dec conversion table
| Gray | dec |
|---|---|
| 1 Gray | 1 dec |
| 10 Gray | 3 dec |
| 100 Gray | 7 dec |
| 1000 Gray | 15 dec |
| 1010 Gray | 12 dec |
| 1111 Gray | 10 dec |
| 10000 Gray | 31 dec |
| 11111 Gray | 21 dec |
| 100000 Gray | 63 dec |
| 1000000 Gray | 127 dec |
| 1100100 Gray | 71 dec |
| 10000000 Gray | 255 dec |
| 11111111 Gray | 170 dec |
| 100000000 Gray | 511 dec |
| 1000000000 Gray | 1,023 dec |
| 1111101000 Gray | 688 dec |
| 10000000000 Gray | 2,047 dec |
Quick answers
Quick answers
- How many Gray is 1 dec?
- 1 dec is 1 Gray.
- How many Gray is 10 dec?
- 10 dec is 1111 Gray.
- How many Gray is 255 dec?
- 255 dec is 10000000 Gray.
The units
About these units
Decimal (dec)
Base ten, the everyday counting system, using digits 0 to 9.
Gray code (Gray)
Reflected binary code: the next number changes only one bit. Used by rotary encoders.
Keep going