Hyphen, Em Dash and En Dash in HTML

While developing any application, oftentimes, it is required to add symbols within the web document. Several are not present on a keyboard. To enter them in an HTML document, the entity codes are used. These codes begin with a “&” and end with the semicolon “;”.

This write-up will cover:

How to Add a Hyphen in HTML?

The hyphen can simply be added with the help of the keyboard. It is the smallest dash “” present next to the “0” button on a regular keyboard:




How to Add En Dash in HTML?

The en dash is slightly larger than the hyphen. It is utilized to show any range, such as 25-50. The entity code “&ndash;” and “” are used to add en Dash to the document:

<p> year (1889 &ndash; 1999)</p>
<p> age (2550)</p>



How to Add Em Dash in HTML?

The em dash is double the size of the en dash symbol. It is utilized to connect two sentences that are related to each other.

Here, the entity code “&mdash;” and “” are utilized to add em dash to the web page:

<p>Summers &mdash; The hottest season of the year. </p>
<p>Summers — The hottest season of the year. </p>



This is how you can add hyphens, em dash, and en dash in HTML.


To add the symbols in HTML, the entity codes are utilized. These codes start with the ampersand “&” sign and end with the semicolon “;”. These codes are used for symbols that are not present on the keyboard or interpreted as HTML codes. The “&ndash;” and “” entity codes are utilized to enter the en dash symbol. The “&mdash;” and “” HTML codes insert the em dash symbols. This post has explained how to add hyphens, em dash, or en dash in an HTML document.

About the author

Nadia Bano

I am an enthusiastic and forward-looking software engineer with an aim to explore the global software industry. I love to write articles on advanced-level designing, coding, and testing.