Gray code converter
Convert numbers to Gray (reflected binary) code and back, or generate a full Gray code table.
Gray code converter
Gray code — also called reflected binary code — is a way of ordering binary numbers so that only one bit changes between any two consecutive values. This tool converts a number to its Gray code equivalent and back, and pastes straight from whatever format you already have it in.
Choose the input format (decimal, binary or hexadecimal) and the output format independently, then pick a bit width from 4 to 32 bits — the result is zero-padded to that width so every value lines up. Set the direction to "Number → Gray code" to encode, or flip it to "Gray code → number" to decode; the swap button carries the current output back into the input so you can check a round trip in one click. Paste a whole list and each line converts on its own, so batch conversion needs no extra setup.
Turn on "Generate full Gray code table" to list every value for the chosen bit width instead — decimal, binary and Gray columns side by side, either as an aligned table or as CSV you can drop straight into a spreadsheet. Because the row count doubles with every extra bit, table generation is capped at 16 bits; wider widths still work for ordinary conversion.
Everything runs locally in your browser — nothing you paste or convert is ever sent anywhere. Copy the result, download it as a .txt file, or send the output back into the input to chain another conversion.