Binary to Gray Code Converter
Guide
Binary to Gray Code Converter
Convert between binary and Gray code (reflected binary code) instantly. Enter a binary number, Gray code, or decimal value and see all representations with a step-by-step XOR visualization showing exactly how the conversion works. Supports up to 64-bit values with batch conversion mode.
How to Use
Select your input type (Binary, Gray Code, or Decimal), enter a value, and choose a bit width (Auto, 4-bit, 8-bit, 16-bit, 32-bit, or 64-bit). The converter instantly displays all representations: binary, Gray code, decimal, hex, and octal — each with a copy button. View the step-by-step XOR visualization to understand exactly how the conversion works bit by bit. Check the conversion table for quick reference, or use batch mode to convert multiple values at once.
Features
- Bidirectional Conversion — Convert Binary to Gray code, Gray code to Binary, or start from Decimal. All conversions happen instantly with no button clicks needed.
- XOR Step-by-Step Visualization — See the exact XOR operation for each bit position with color-coded pairs, making it easy to understand and verify the conversion algorithm.
- Multiple Output Formats — Binary, Gray code, decimal, hexadecimal, and octal — each with a dedicated copy button for quick use.
- Conversion Table — Reference table showing Decimal, Binary, and Gray code for ranges 0-15, 0-31, 0-63, or 0-255. Current input value is highlighted.
- Batch Mode — Convert multiple values at once. Enter one value per line, select input and output formats, and get results in a table with copy-all functionality.
- Flexible Bit Width — Auto-detect or manually set to 4-bit, 8-bit, 16-bit, 32-bit, or 64-bit. Uses BigInt for values exceeding 32 bits.
- Reference Guide — Explanation of Gray code, the XOR algorithm, single-bit transition property, reflected construction, and real-world applications.
What is Gray Code?
Gray code (also called reflected binary code) is a binary numeral system where two successive values differ in only one bit. Standard binary counting changes multiple bits simultaneously (e.g., 0111 to 1000 changes all four bits), which can cause glitches in hardware. Gray code eliminates this problem — each increment changes exactly one bit. This property makes Gray code essential for rotary encoders, analog-to-digital converters, Karnaugh maps, error correction, and any application where simultaneous bit transitions cause errors.
How do you convert binary to Gray code?
How do you convert Gray code back to binary?
Why is Gray code used in rotary encoders?
Is my data sent to a server?
Install Our Extensions
Add IO tools to your favorite browser for instant access and faster searching
恵 Scoreboard Has Arrived!
Scoreboard is a fun way to keep track of your games, all data is stored in your browser. More features are coming soon!
Must-Try Tools
View All New Arrivals
View AllUpdate: Our latest tool was added on Apr 14, 2026
