We use hyphens (-) to link two separate word elements to form a compound word. In some words, hyphens separate prefixes, suffixes, single letters, and numbers from the rest of the word. E.g., two-way street, well-liked celebrity, president-elect, mid-March, etc.
On the other hand, an en dash (–) is longer than a hyphen, but shorter than an em dash (—).
When an en dash is inserted, it should not have spaces on either side. It is mainly used between dates to mark a span of time. However, if we have a two-word adjective phrase that must be connected to a noun, an en dash is used instead of a hyphen to create a variant of the compound adjective. E.g., 1925–1946, big bang–like music.
Finally, an em dash (—) is the longest line among these three marks of punctuation. Em dashes are most often used in pairs in place of commas or parentheses to call a reader’s attention to something particularly dramatic or emotional.
Alternatively, pairs of em dashes are used to mark additional information that elaborates on details of a sentence but might not be essential to understanding the sentence.
Spacing around an em dash is still an arbitrary decision, therefore, whether we choose to include spaces around em dashes or not, we need to be consistent.
E.g., Their mother forced them to remember something that had long forgotten—their childhood dreams.; Kelly Clarkson—the first winner of American Idol—just released a new album.