HTML Em Dash Code

This page contains HTML code for adding an em dash within the text of your website or blog.

The em dash is a punctuation mark that can be used in place of a comma, parentheses, or a colon — usually for the purposes of improved readibility.

Create an Em Dash

To create an em dash in HTML, use the appropriate HTML entity. Type either the entity number or entity name where you'd like the em dash to appear.

HTML Entity Number

Here's how you use the HTML entity number to display an em dash.

Source Code

Result

—

HTML Entity Name

This example uses the entity names to display the em dash.

Source Code

Result

—

Usage Example

Here's an example of using an em dash within a sentence.

Source Code

Result

After visiting the library—to read up on how mind affects matter—I proceeded to the gym and set a new world record for bench press.

Em Dash vs En Dash

To the untrained eye, an em dash could easily be mistaken for an en dash or even a hypen. This is because the only difference (visually) between those three characters is their width. The em dash is the widest. The en dash is slightly narrow than the em dash, and the hypen is slightly narrower again.

All three have different purposes, so be sure to use the correct character for your intended purpose.