Why this tool is useful
Use Gray code conversion for rotary encoders, state machines and adjacent-value test vectors where only one bit should change between successive encoded numbers.
Convert a bounded unsigned integer to binary-reflected Gray code or decode Gray code back to binary at a fixed width.
Ready. Your working data stays in this browser.
Use Gray code conversion for rotary encoders, state machines and adjacent-value test vectors where only one bit should change between successive encoded numbers.
Encoding XORs the integer with itself shifted right once; decoding repeatedly XORs the accumulated value with progressively shifted Gray bits, all inside the chosen width.
Decimal 10 is binary 00001010 and encodes to Gray value 15, binary 00001111; decoding 15 restores decimal 10.
The calculation is deterministic and explains validation errors instead of silently changing invalid input.
Input and output remain in this tab. Copy and download happen through browser APIs without a server upload.
Every run reports its tool mode, timestamp and input/output size so transformed data can be audited.