Why is "night" spelled with "gh"?

When you see a GH spelling in English and it's silent or not pronounced like G, you're dealing with Middle English. That's the language for which English spelling was developed.

Middle English had an /h/ phoneme, and it occurred both

  • pronounced [h] before vowels
    (where /h/ occurs in Modern English: Ha he who huh hey /ha hi hu hə he/)

and

  • pronounced [x] (rather like German CH or Russian Х or Hebrew ח) after vowels.
    It was spelled GH in those cases, because it was pronounced [x], instead of [h].

Part of the change from Middle to Modern English was that the postvocalic [x] allophone of /h/ either disappeared (as in night), or mutated to another fricative, like [f] in enough or trough.

Once these had disappeared (leaving only fossils in the spelling), the prevocalic allophones, having no other H-like sounds to contrast with, mutated into the current bevy of voiceless vocal onsets.