← Developer & Data
Developer & Data · runs locally

Binary-reflected Gray Code Converter

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.

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.

How it works

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.

Practical example

Decimal 10 is binary 00001010 and encodes to Gray value 15, binary 00001111; decoding 15 restores decimal 10.

Validation

The calculation is deterministic and explains validation errors instead of silently changing invalid input.

Privacy boundary

Input and output remain in this tab. Copy and download happen through browser APIs without a server upload.

Result passport

Every run reports its tool mode, timestamp and input/output size so transformed data can be audited.