Every Single CalculatorOne place for every calculator
</>Tech, screens and electronics

Gray code calculator

Binary counting where only one bit changes at a time.

Example: You are wiring a rotary encoder.

Your numbers

  • Gray code0
  • Ordinary binary0
  • Gray code of the next number0
  • Read as Gray code, your number decodes to0

How it is worked out

Gray code = the number XOR itself shifted right by one bit

A worked example

5 is 0101 in binary and 0111 in Gray code. The next number, 6, is 0101: only one bit different.

How we know this calculator is right

Before this calculator went on the site, 8 answers were worked out separately from its code, by hand or straight from the formula above. Each time this page loads, your own browser runs the calculator on those same numbers and compares. Turn on JavaScript to see the comparison.

See every check
Numbers usedResultWorked out separatelyThis calculator

What this proves: the calculator does the arithmetic of the formula shown, correctly. What it cannot prove: your measurements, or figures such as coverage per bag, waste and spacing, which are typical starting values you can change. Go by the product label and your local code.

Your turn

This site is built from what people ask for. Is something missing from this calculator, or is there another one you need?

Ask for a calculatorBuild your own

Spotted a mistake? Tell us about this page and we will fix it.

Used by: tech and screens.