According to the AP Stylebook: “Use of the hyphen is far from standardized. It is optional is most cases, a matter of taste, judgment and style sense. But the fewer hyphens the better … “. The decision whether or not a phrase should be hyphenated has caused many people many headaches.
Here are a few guidelines I trust:
A hyphen should be used to connect words in contexts where not to do so would cause a glitch in the logical decoding of a written communication. The example given in the 2011 AP Stylebook is “small-business owner.” One might argue that the larger context of the writing will lead the reader to the correct interpretation of the phrase, for example, in a trade magazine devoted to business topics one would not expect to be reading about diminutive people who own businesses; however, decoding is meant to be linear, and the import of good writing is self-contained. Notice that the hyphen is made necessary by the presence of two nouns following an adjective, in order to make clear which noun is meant to be modified: “She runs a small business” or “He is a business owner” do not present an issue.
Hyphens are used to create a single concept from multiple words, to create either a noun or an adjective: “That coat is run-of-the-mill.” “The party is come-as-you-are.” “Her husband is a stick-in-the-mud.” Leaving the hyphens out would cause the brain to stumble upon an illogical word order.
The rule of hyphenating a multiple-word phrase which expresses a single modifier applies to adverbs as well, except those which end in -ly, since that suffix of itself denotes modification of the subsequent word: “user-friendly interface” but “environmentally friendly products.”
Some styles accept turning a word phrase which might be hyphenated into a single compound word. For example, I have edited many articles concerning “health care” in the past several years and have come to follow what seems to be a trend, at least according to Googled examples: Instead of talking about health-care plans, health-care costs, etc., one sees “healthcare” used as a single word.
Two terms I struggle with are “high school student” and “middle-school student.” To my eye it simply looks right to hyphenate the latter and not the former, but I have no rational basis for doing so.