The hyphen (-) 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 (see used-book store). 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 to indicate a range of values, connect or contrast word pairs, and replace versus or to: Yankees are winning 6–3, 1990–2000, the North–South divide. Some editors use the en dash to connect phrasal adjectives: She was a Man Booker–winning writer, used-record–store. I do not seen this habit often, and it can look a little clunky, as in the second example, so follow your preferred style guide on the matter. Type the en dash with option-hyphen on Macs and alt-0150 on Windows.
Most modern style guides reserve the em dash for interruptions in a sentence. It is 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 parenthetical thoughts or asides—like so—or clarifications of concepts, as demonstrated in this entry’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 can also indicate dialogue (see anything by James Joyce) or an interruption, such as when one character cuts off another character’s dialogue: “I told him to—” / “You told whom?” More than three em dashes in a single sentence can cause readers to lose the main thread of thought. Type the em dash with option-shift-hyphen on Macs and alt-0151 on Windows. 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 continue this habit.
When formatting em dashes, The Chicago Manual of Style, Publication Manual of the American Psychological Association, MLA Handbook, Garner’s Modern English Usage, and many American publishers require the em dash without spaces on either side, as shown in my writing. The Associated Press Stylebook, which only some journalists should follow, spaces the em dash — as shown here. You may also see em dashes styled 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 spaced en dash, castrated, dangles precariously in its empty space, suggesting rather than directing. Use the standard unspaced em dash unless you bear a strong editorial objection.