TOP

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.

No signupFree online conversion

Interactive tool

Convert Gray Code to Hex

Ready

Output format

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.

InputOutputMeaning
00zero boundary
11one boundary
1111Aexact conversion
11008exact 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

Choose the exact conversion direction you need.

Advertisement

Sponsored link