HTML Escape Characters

HTML escape characters (HTML entities) let you display characters that would otherwise be interpreted as code, or that aren't easy to type directly. Every entity starts with & and ends with ; — for example, & renders as &. This reference lists the entities you'll actually use, grouped by category, with their named and numeric forms.

Two ways to write any entity: a named form (©) and a numeric form (© decimal or © hex). Named entities are more readable; numeric entities work for any Unicode character even without a name.


Reserved Characters (Must Escape)

These have special meaning in HTML and must be escaped to display literally or to avoid breaking your markup.

CharacterNamed EntityNumericDescription
&&&Ampersand
<&lt;&#60;Less-than sign
>&gt;&#62;Greater-than sign
"&quot;&#34;Double quote
'&apos;&#39;Single quote / apostrophe

Spaces & Punctuation

CharacterNamed EntityNumericDescription
(space)&nbsp;&#160;Non-breaking space
&ndash;&#8211;En dash
&mdash;&#8212;Em dash
&hellip;&#8230;Horizontal ellipsis
&lsquo;&#8216;Left single quote
&rsquo;&#8217;Right single quote
&ldquo;&#8220;Left double quote
&rdquo;&#8221;Right double quote
·&middot;&#183;Middle dot
&dagger;&#8224;Dagger

Currency Symbols

SymbolNamed EntityNumericDescription
¢&cent;&#162;Cent
£&pound;&#163;Pound sterling
&euro;&#8364;Euro
¥&yen;&#165;Yen
&#8377;Indian Rupee
$&#36;Dollar (no escaping needed)

Common Symbols

SymbolNamed EntityNumericDescription
©&copy;&#169;Copyright
®&reg;&#174;Registered trademark
&trade;&#8482;Trademark
°&deg;&#176;Degree
§&sect;&#167;Section
&para;&#182;Paragraph (pilcrow)
&bull;&#8226;Bullet

Math & Technical Symbols

SymbolNamed EntityNumericDescription
×&times;&#215;Multiplication sign
÷&divide;&#247;Division sign
±&plusmn;&#177;Plus-minus
&ne;&#8800;Not equal to
&le;&#8804;Less than or equal
&ge;&#8805;Greater than or equal
&infin;&#8734;Infinity
&radic;&#8730;Square root
½&frac12;&#189;One half
¼&frac14;&#188;One quarter

Arrows

SymbolNamed EntityNumericDescription
&larr;&#8592;Left arrow
&rarr;&#8594;Right arrow
&uarr;&#8593;Up arrow
&darr;&#8595;Down arrow
&harr;&#8596;Left-right arrow
&rArr;&#8658;Double right arrow

Accented & Special Letters

CharacterNamed EntityNumericDescription
á&aacute;&#225;a with acute
é&eacute;&#233;e with acute
ñ&ntilde;&#241;n with tilde
ü&uuml;&#252;u with umlaut
ç&ccedil;&#231;c with cedilla
ø&oslash;&#248;o with stroke
ß&szlig;&#223;Sharp s (eszett)

Golden Rules for HTML Escaping

  1. Always escape the big three<, >, and & — in any content that could be interpreted as markup.
  2. Escape quotes inside attributes — use &quot; (or &#39; for single quotes) when a quote character appears inside an attribute value.
  3. Escaping is your first defense against XSS — never inject unescaped user input into HTML. Let your framework or a trusted library escape it.
  4. Prefer UTF-8 over entities for regular text — with a UTF-8 charset you can type é or → directly; reserve entities for reserved characters and invisible ones like &nbsp;.
  5. Numeric entities always work — if a character has no named entity, use its numeric (&#8377;) or hex (&#x20B9;) code point.

Frequently Asked Questions

What are HTML escape characters? They're special codes (HTML entities) that represent characters which are reserved in HTML or hard to type. Each starts with & and ends with ;, such as &amp; for &.

Which characters must be escaped in HTML? At minimum, escape & (&amp;), < (&lt;), and > (&gt;). Inside attribute values, also escape quotes with &quot; or &#39;.

What is the difference between named and numeric entities? Named entities like &copy; are readable but limited to characters that have a defined name. Numeric entities like &#169; work for any Unicode character using its code point, in decimal or hex.

How do I add a non-breaking space in HTML? Use &nbsp;. It renders as a space that won't collapse or break onto a new line, useful for keeping words or values together.

Why should I escape user input? Unescaped user input can be interpreted as HTML or script, leading to cross-site scripting (XSS) attacks. Escaping reserved characters ensures the input is displayed as text, not executed as code.

Do I still need entities if my page uses UTF-8? For most visible characters, no — you can type them directly. You still need entities for the reserved characters (&, <, >) and for invisible or ambiguous characters like non-breaking spaces.

Last Updated on Jul 13, 2026