Em dash (—) in HTML
The em dash is a long horizontal rule used to break a sentence. Its named reference is — and its code point is U+2014, one width step longer than the en dash.
At a glance
- Character
- —
- Named entity
- —
- Decimal reference
- —
- Hex reference
- —
- Unicode code point
- U+2014
- Unicode name
- EM DASH
- In the entity reference
- Punctuation, and pinned in quick access
In detail
The name comes from metal type, where the character was cast one em wide, meaning as wide as the point size of the font. In a 16 pixel font that is nominally 16 pixels of horizontal rule, although modern typefaces vary and many draw it slightly narrower. It is the longest of the three dashes in common use, sitting above the en dash and the hyphen.
Because pages are served as UTF-8 the character can be typed directly and needs no reference at all. The entity is still worth knowing for three situations: templates that pass through a system with an unknown encoding, email HTML where legacy clients still mangle high bytes, and source files where a literal long dash is visually indistinguishable from an en dash during review.
This site's style guide avoids the character in prose, and that is a considered position rather than a formatting preference. It marks a break that a comma, a pair of parentheses, a colon or a full stop can all express more precisely, it is the punctuation mark most strongly associated with machine written text, and the spacing conventions around it differ between British and American practice so no single rendering looks right to every reader.
If you do use it, do not fake it with two hyphens. That was a typewriter workaround, it does not line break the same way, it will not match a search for the real character, and any typographic replacement step that converts it will do so inconsistently across your content depending on when the content was written.
Examples
<p>hyphen: co-operate</p>
<p>en dash: pages 12–18</p>
<p>em dash: the plan—such as it was—failed</p><p>The plan, such as it was, failed.</p>
<p>The plan (such as it was) failed.</p>
<p>The plan failed; nobody was surprised.</p>Things that catch people out
- A line will break after this character but not before it in most engines, so a dash left at the end of a narrow column looks like a stray rule. Test at mobile widths before committing to the style.
- Word processors auto convert two hyphens into this character on the fly. Content pasted from one will contain a mix of real dashes and hyphens that no regular expression cleans up reliably.
- Screen readers differ on whether they announce it, pause on it, or skip it silently, so a sentence whose meaning depends on the break may not carry that meaning aloud.
Try it: HTML Entity Reference
Search 152 entities across 9 categories, switch the copy format between the character, the name, the decimal form and the hex form, and copy in one click.
HTML Entity Reference
LOCAL · Browser-OnlySearchable reference of 150+ HTML entities with one-click copy in any format
152 entities across 9 categories
Commonly Used
→Arrows(13)
±Math(35)
$Currency(8)
…Punctuation(21)
©Symbols(24)
πGreek(30)
½Fractions(6)
●Geometric(7)
æLatin Special(8)
Click any entity card to copy it in your chosen format. All data is embedded in the page and works offline.
Related HTML entities
All html entities →En dash (–) in HTML
The en dash at U+2013 joins ranges and paired terms. Its entity forms, how wide it really is, and how to stop spreadsheets turning your ranges into dates.
Minus sign (−) in HTML
The true minus sign at U+2212 and the hyphen-minus at U+002D. Why negative numbers in a table need the real character, and where it breaks copy and paste.
Ellipsis (…) in HTML
The horizontal ellipsis at U+2026 versus three typed periods. Entity forms, line breaking behaviour, search implications and the CSS text-overflow case.
Bullet (•) in HTML
The bullet at U+2022 with its entity forms, why a real list beats a typed bullet, and how to use it as a separator without confusing a screen reader.
Middle dot (·) in HTML
The interpunct at U+00B7, its entity forms, its use as a byline separator, its role in Catalan spelling, and how it differs from the bullet and dot operator.
Curly quotes: ‘ ’ “ and ”
The opening and closing single and double curly quotes, their entities and code points, when they help prose and when they break code and search.
Tools for this
- HTML Entity Reference Free online HTML entity reference - search and copy HTML entities with live preview
- HTML Entity Encoder Free online HTML entity encoder - encode or decode HTML entities to prevent XSS and display issues