MFAYSAL.DEV

Gray Code to Hex Converter

Enter a Gray code value in hex or binary. Free, private and runs in your browser.

Your details

Input written as

Result

What is Gray code?

Gray code (reflected binary code) is an ordering of binary numbers where consecutive values differ by exactly one bit. Rotary encoders, absolute position sensors and Karnaugh maps use it, because a mechanical sensor moving between two positions can never misread several bits changing at once.

How to convert Gray code to binary

The first binary bit equals the first Gray bit. Each next binary bit is the previous binary bit XOR the current Gray bit. For Gray 11111 (hex 1F): 1, 1⊕1=0, 0⊕1=1, 1⊕1=0, 0⊕1=1, giving binary 10101 = hex 15. Going the other way, Gray = binary XOR (binary shifted right by one).

Frequently asked questions

What is 1F in Gray code as hex?

15 (binary 10101, decimal 21).

Why is Gray code used?

Only one bit changes between neighbouring values, which avoids glitches in encoders.

✨ New: Remove the background from any image free – private, in your browser, transparent PNG.

Related free tools

Browse all 102 free tools →

Note: This free tool runs entirely in your browser. No data is sent or stored. Results are for information only.