When used as an adjective or adverb, the words over and night are combined into a single compound word, overnight—for example:
Cover and refrigerate overnight. [Mommy's Kitchen]
His Olympic super-combined originally was set for Tuesday but an overnight snowstorm forced organizers to push the race back to Sunday. [Associated Press]
Most edited publications adhere to this rule—for example:
A blizzard strands four bus passengers overnight in a small-town diner 40 miles west of Kansas City. [NY Times]
He ordered the suspect held overnight. [Wall Street Journal]
The couple were interviewed overnight and were unable to return to their home until forensic examinations were completed. [The Guardian]
The two-word over night is reserved for constructions such as I prefer day over night, but these don’t come up often. If you’re ever in doubt, it’s probably safe to go with overnight.

