Gray code, also known as reflected binary code, is a numeral system where consecutive integers differ by exactly one bit. This property makes Gray code extremely useful in digital electronics, rotary encoders, analog-to-digital converters, and error detection circuits.
In standard binary counting, multiple bits can change at the same time when incrementing by one (e.g., 0111 → 1000 changes all four bits). In mechanical or electronic systems, this can cause brief glitches where an incorrect intermediate value is read. Gray code eliminates this by ensuring only a single bit changes between any two consecutive values.
Gray code is named after Frank Gray, a physicist at Bell Labs who patented it in 1953, though similar codes appeared earlier in telegraph systems.
No. Gray code uses the same number of bits but in a different arrangement. The values look different, but both represent the same numbers. They require conversion to use in arithmetic.