HTML Entity Encoder

HTML entities are special character sequences that begin with an ampersand (&) and end with a semicolon (;). They serve two critical purposes: displaying reserved HTML characters as literal text rather than code, and representing characters that aren't easily typed on standard keyboards.

Without HTML entities, browsers would interpret characters like < and > as HTML tag delimiters. For example, typing "<script>" directly in HTML would create an actual script tag. By encoding it as "&lt;script&gt;", the browser displays the literal text instead.

Common examples include:

  • &lt; for < (less than)
  • &gt; for > (greater than)
  • &amp; for & (ampersand)
  • &quot; for " (quotation mark)
  • &apos; for ' (apostrophe)
  • &copy; for © (copyright)
  • &nbsp; for non-breaking space