Free browser converter
Gray Code to Hex Converter
Convert reflected binary Gray code to hexadecimal online with cumulative XOR, exact BigInt arithmetic, strict validation, case options, and 0x output.
Interactive tool
Convert Gray Code to Hex
Ready
Choose an explicit output representation.
Detailed conversion guide
How to Convert Gray Code to Hex
First reverse reflected Gray encoding with cumulative XOR to recover the ordinary binary integer.
Gray 1111 decodes to binary 1010. Grouping that binary value as 1010 gives hexadecimal A.
| Input | Output | Meaning |
|---|---|---|
0 | 0 | zero boundary |
1 | 1 | one boundary |
1111 | A | exact conversion |
1100 | 8 | exact conversion |
Gray Code to Hex with BigInt
The decoder uses BigInt throughout, so Gray codes longer than JavaScript's safe Number range stay exact.
let binary = gray;
for (let shift = gray >> 1n; shift; shift >>= 1n) binary ^= shift;
const hex = binary.toString(16).toUpperCase();Hex Case, Prefix, and Gray Validation
Only reflected binary Gray code is accepted. Invalid bits are rejected instead of being silently removed.
Uppercase, lowercase, and 0x-prefixed output are formatting choices. They represent the same decoded integer.
Related converters
Continue with related data converters
Choose the exact conversion direction you need.