The hyphen (-), overused in American English, primarily functions to combine phrasal adjectives—two or more words understood together as an adjective modifying a noun: high-density tube, used-record store. Omitting the hyphen may result in a miscue: a used record store may be a record store that is used or a store that sells used records. Hyphens do not typically follow prefixes: prefer nonprofit to non-profit, though in some situations the hyphen may be necessary to avoid confusion: prefer re-sign to resign to indicate signing something again.
The dash comes in two flavors: en dash (–) and em dash (—), named due to their lengths approximating a capital N and M respectively. Reserve the en dash for a range of values, connection or contrast between word pairs, and in place of versus or to: Yankees are winning 6–3, 1990–2000, the North–South divide. Some publishers and editors like to use the en dash to connect phrasal adjectives: Man Booker–winning writer, used-record–store. I have not seen this in common usage, so in this situation it’s best to follow your preferred style guide. Type the en dash on Macs with option-hyphen and on Windows with alt-0150 (or copy-paste the symbol). Don’t use hyphens in place of dashes; doing so was a typewriter habit, and since we no longer use typewriters, we no longer have reason to not use the proper symbols.
Most modern style guides reserve the em dash for interruptions or pauses in a sentence, stronger than a comma and more useful than a semicolon (some compare it to parentheses in effect, though I prefer the em dash for its visual fluidity: see parentheses). The em dash can mark a parenthetical thought or aside—like so—or a clarification of a concept, as demonstrated in this article’s first sentence. Two conjoined em dashes style missing or omitted names: I met Mrs. S—— yesterday on —— St. In creative writing, the em dash also functions to indicate an interruption, such as when one character cuts off another character’s dialogue: “I told him—” / “You told whom?” Avoid overusing em dashes in a single sentence; too many can convolute the parenthetical for the main sentence. Type the em dash on Macs with option-shift-hyphen and on Windows with alt-0151.
When formatting em dashes, The Chicago Manual of Style, the APA Publication Manual, the MLA Handbook, Garner’s Dictionary of Modern English Usage, and many American publishers require the em dash without spaces on either side, as shown in my writing. The AP Stylebook, which only some journalists should follow, spaces the em dash on either side — as shown here. Occasionally you may see em dashes written as spaced en dashes – a rarity in American publishing, though the preferred method of The Elements of Typographic Style. Its author argues that the em dash cramps modern fonts while the spaced en dash does not. I disagree; the en dash, castrated, dangles precariously in its empty space, suggesting rather than directing. Use the standard unspaced em dash unless you bear a strong visual or editorial objection.