Code Converters - Binary To_from Gray Code - GeeksforGeeks
Code Converters - Binary To_from Gray Code - GeeksforGeeks
Aptitude Engineering Mathematics Discrete Mathematics Operating System DBMS Computer Netw
Table of Content
Code Converters
Binary Code
Gray Code
Converting Binary to Gray Code
Converting Gray Code to Binary
Application
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 1/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
b0 , b1 , b2 , and b3
b0
b3
g0 , g1 , g2 , and g3
be the bits representing the gray code of the binary numbers, where
g0
g3
g0
K-map for
g1
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 3/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
K-map for
g2
K-map for
g3
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 4/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
g0 = b0 b′1 + b1 b′0 = b0 ⊕ b1
g1 = b2 b′1 + b1 b′2 = b1 ⊕ b2
g2 = b2 b′3 + b3 b′2 = b2 ⊕ b3
g3 = b3
Gn= Bn
G 1 = B 2 XOR B 1
b0 , b1 , b2 , and b3
b0
b3
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 5/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
g0 , g1 , g2 , and g3
be the bits representing the gray code of the binary numbers, where
g0
g3
b0
K-map for
b1
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 6/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
K-map for
b2
K-map for
b3
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 7/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 8/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
Bn= Gn
Conclusion
In this Article we have gone through Code Converters – Binary to/from
Gray Code,we have gone through the definition of the Code
converters,Binary code and Gray code,then we have gone through Code
conversion between Binary to Gray code and vice versa.
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 9/15
21/02/2025, 18:35 Code Converters - Binary to/from Gray Code - GeeksforGeeks
Chirag Manwani
. If you like GeeksforGeeks and would like to contribute, you can also
write an article using
write.geeksforgeeks.org
or mail your article to [email protected]. See your article
appearing on the GeeksforGeeks main page and help other Geeks.
Dreaming of M.Tech in IIT? Get AIR under 100 with our GATE 2026
CSE & DA courses! Get flexible weekday/weekend options, live
https://www.geeksforgeeks.org/code-converters-binary-to-from-gray-code/ 10/15