Decimal to Gray Code Converter

Convert decimal to Gray code using binary reflected logic

Input
Gray Code Result
0100
Decimal: 7
Binary: 0111

What is Gray Code?

Gray code, also known as reflected binary code, is a binary numeral system where two successive values differ in only one bit. This property prevents errors in digital communication, rotary encoders, and Karnaugh maps. The conversion uses XOR operation: G = B ^ (B >> 1).