Ad โ€“ 728ร—90
๐ŸŒ Beginner

HTML Entities โ€“ Special Characters in HTML

Some characters have special meaning in HTML โ€” like < (tag opening) and & (entity start). To display these characters as visible text you use HTML entities. Entities also let you insert special symbols (ยฉ, โ„ข, โ†’, non-breaking spaces) reliably across all browsers.

โฑ๏ธ 10 min read๐ŸŽฏ Beginner๐Ÿ“… Updated 2026

Why Entities Exist

The browser uses < and > to identify HTML tags, and & to start an entity. If you type these directly as content the browser gets confused:

HTML
<!-- Problem: browser thinks <script> is a real tag -->
<p>Use the <script> tag for JavaScript.</p>

<!-- Solution: escape the angle brackets -->
<p>Use the &lt;script&gt; tag for JavaScript.</p>
<!-- Renders as: Use the <script> tag for JavaScript. -->

Most Common HTML Entities

EntityCharacterDescription
&lt;<Less-than sign (tag open)
&gt;>Greater-than sign (tag close)
&amp;&Ampersand
&quot;"Double quote
&apos;'Apostrophe / single quote
&nbsp;(space)Non-breaking space โ€” prevents line break between words
&copy;ยฉCopyright symbol
&reg;ยฎRegistered trademark
&trade;โ„ขTrademark symbol
&mdash;โ€”Em dash
&ndash;โ€“En dash
&hellip;โ€ฆEllipsis
&euro;โ‚ฌEuro sign
&pound;ยฃPound sign
&rarr;โ†’Right arrow
&larr;โ†Left arrow
Ad โ€“ 336ร—280

Practical Examples

HTML
<!-- Copyright footer -->
<p>&copy; 2026 ylearner. All rights reserved.</p>

<!-- Non-breaking space: prevents "10" and "km" splitting onto separate lines -->
<p>Distance: 10&nbsp;km</p>

<!-- Displaying code in text -->
<p>The &lt;div&gt; tag is a block container.</p>

<!-- Price range with en dash -->
<p>Price: &pound;10&ndash;&pound;50</p>

<!-- Trademark -->
<p>ylearner&trade; โ€” Learn to code for free.</p>

<!-- Numeric entity (decimal) -->
<p>&#169; 2026</p>  <!-- Same as &copy; -->

<!-- Numeric entity (hex) -->
<p>&#x2665;</p>  <!-- โ™ฅ -->

Entities vs Unicode in HTML5

With <meta charset="UTF-8"> (which every modern HTML5 page should have), you can type most special characters directly into your HTML file โ€” your code editor saves them as UTF-8 characters the browser reads correctly. Entities are still useful for <, >, and & which are structurally significant, and for non-breaking spaces.

HTML
<!-- In HTML5 with UTF-8, these are equivalent: -->
<p>&copy; 2026</p>
<p>ยฉ 2026</p>  <!-- Direct Unicode character -->

<!-- But these MUST use entities: -->
<p>&lt;tag&gt;</p>    <!-- Displaying < and > as text -->
<p>5 &amp; 10</p>   <!-- Displaying & as text -->

๐Ÿ“‹ Summary

  • HTML entities start with & and end with ; โ€” e.g. &amp;, &lt;, &copy;.
  • Must-escape: &lt; (<), &gt; (>), &amp; (&) โ€” these are structurally reserved in HTML.
  • &nbsp; โ€” non-breaking space, prevents unwanted line breaks.
  • In HTML5 with UTF-8, you can type most symbols directly. Entities are mainly needed for the reserved characters.