Decimal to Gray Code Converter
Convert decimal to Gray code (binary), live as you type.
Gray code is a binary numbering system where consecutive values differ by exactly one bit — used in rotary encoders and error correction to avoid glitches from multiple bits flipping at once. Converts live as you type, entirely in your browser.
Need the opposite? Use Gray Code to Decimal Converter
What is Decimal to Gray Code Converter?
Gray code is a binary numbering system where consecutive values differ by exactly one bit — used in rotary encoders, Karnaugh maps, and error correction to avoid glitches from multiple bits flipping at once during a transition. Type a decimal number and get its Gray code equivalent instantly, with optional bit-width padding so the output lines up at a fixed length across a batch of values. Multiple values are supported at once, which is useful when you're building a lookup table or verifying a sequence rather than converting one number at a time. Conversion happens live as you type, entirely in your browser — nothing is sent to a server.
FAQ
In regular binary, counting from 3 to 4 flips three bits (011 → 100). In Gray code, every increment flips exactly one bit, which avoids the ambiguous in-between states a mechanical or electrical sensor could otherwise read.
It pads every output value with leading zeros to a fixed number of bits, so a batch of Gray code values lines up consistently — useful when building a lookup table or feeding results into hardware with a fixed bus width.
Yes — enter multiple values and each is converted to its own Gray code output.