If you are in the United States, gray is more common. If you are in another English-speaking country, grey is preferred.
You can remember this by noting the A and the E in the words:
In America, use grAy.
In England, use grEy.
(But, of course, don’t forget Scotland, Ireland, Australia, and Canada. They use grey too.)