SmartCodingTips

HTML Entities

HTML entities are special codes used to display reserved or invisible characters in HTML. These are useful when you need to display symbols that would otherwise be interpreted as HTML code or cannot be typed directly.

Why Use HTML Entities?

  • To display reserved characters like <, >, and &.
  • To display invisible or special characters like non-breaking spaces or copyright signs.
  • To ensure consistent rendering across all browsers and platforms.

Common HTML Entities

Character Entity Name Entity Number
< &lt; <
> &gt; >
& &amp; &
" &quot; "
  &nbsp;  
© &copy; ©
® &reg; ®

Example Usage


<p>5 &lt; 10 is a valid expression.</p>
<p>Use &copy; for copyright symbol.</p>