How do you convert BCD to gray?

Well, with a BCD to gray code converter, of course.

However as gray code deliberately has no coding glitches and BCD has multiple coding glitches, designing such a converter without introducing coding glitches in the gray code is more difficult than might be imagined. The 6 missing binary codes in BCD are also a significant issue in trying to convert to gray code, as no missed values are permitted.

A coding glitch can occur at any time more than one bit of the code changes to go to the next (or previous) sequential value.