There is no rule. Generally, they start out their lives as two words, become hyphenated along the way, and then mature into single words. You'll need to check your dictionary to be sure what stage the formation is at.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.