← All guides

HTML Entities: How to Escape Special Characters

HTML entities let you display characters like < > & and quotes without breaking your markup. Learn the core entities and when escaping matters.

HTML entities are codes that represent characters which would otherwise be interpreted as markup. For example, < is written as &lt; and & as &amp;, so the browser shows the character instead of treating it as a tag.

The must-know entities

  • &lt;<
  • &gt;>
  • &amp;&
  • &quot;"
  • &#39;'

Named vs numeric

Entities come in two forms: named (&copy;) and numeric (&#169;, or hex &#xA9;). Numeric entities can represent any Unicode character, even when no name exists.

Why it matters

Escaping is essential for security and correctness: user text containing <script> must be escaped so it renders as text, not executable code. This is a first line of defense against injection.

Encode or decode now

Convert text and entities both ways in the HTML entity tool. For characters inside URLs, see What is URL encoding.