I generally know how to use a hyphen, but when should I use an en-dash (–) instead of an em-dash, or when should I use a hyphen (-) instead of an em-dash (—)?
An em-dash is typically used as a stand-in for a comma or parenthesis to separate out phrases—or even just a word—in a sentence for various reasons (e.g. a parenthetical; an ersatz-ellipsis). Examples where an em-dash should be used:
- School is based on the three R’s—reading, writing, and ’rithmetic.
- Against all odds, Pete—the unluckiest man alive—won the lottery.
- I sense something; a presence I've not felt since—
An en-dash is used to connect values in a range or that are related. A good rule is to use it when you're expressing a "to" relationship. Examples where an en-dash should be used:
- in years 1939–1945
- pages 31–32 may be relevant
- New York beat Los Angeles 98–95
- When American English would use an em-dash – following British and Canadian conventions.
A hyphen is used to join words in a compound construction, or separate syllables of a word, like during a line break, or (self-evidently) a hyphenated name.
- cruelty-free eggs
- it's pronounced hos-pi-tal-it-tee
- Olivia Newton-John
The minus sign is distinct from all three of the above.
- 4 − 2 = 2.
If you want to use the correct dash or hyphen in Stack Exchange comments, just use the appropriate HTML entity:
— for em-dash,
– for en-dash, and
− for the minus sign. The hyphen is, of course, directly on your keyboard.
The figure dash (‒) is so named because it is the same width as a digit, at least in fonts with digits of equal width. This is true of most fonts, not only monospaced fonts.
The figure dash is used within numbers (e.g. phone number 555‒0199), especially in columns for maintaining alignment. Its meaning is the same as a hyphen, as represented by the hyphen-minus glyph; by contrast, the en dash is more appropriately used to indicate a range of values; the minus sign also has a separate glyph.
The figure dash is often unavailable; in this case, one may use a hyphen-minus instead. In Unicode, the figure dash is U+2012 (decimal 8210). HTML authors must use the numeric forms
‒ to type it unless the file is in Unicode; there is no equivalent character entity.