Binary ↔ Gray Code Conversion Circuits

Click input bits to toggle values and see the XOR gate logic in action

Binary → Gray Code Gᵢ = Bᵢ₊₁ ⊕ Bᵢ (MSB: G₃ = B₃)
Verification
Binary → Gray
Binary: 0101 = 5
Gray: 0111 = 7
Gray → Binary
Gray: 0111 = 7
Binary: 0101 = 5
Dec Binary Gray
Gray Code → Binary Bᵢ = Bᵢ₊₁ ⊕ Gᵢ (MSB: B₃ = G₃)
Binary → Gray: Parallel
All XOR gates operate simultaneously — O(1) delay
XOR Gate Truth Table
0⊕0=0   0⊕1=1   1⊕0=1   1⊕1=0
Gray → Binary: Cascaded
Each gate waits for previous output — O(n) delay