Cheat Sheets Web & HTTP

HTML Entities Cheat Sheet

The HTML entities you actually use, with name, decimal code and meaning, which five characters to escape and how entities are decoded.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page
On this page

An HTML entity writes a character as &name; or as a number © (decimal) or © (hex), so that it can be typed anywhere and cannot be mistaken for markup. Encode text with the HTML Entity Encode and decode it with the HTML Entity Decode. The numbers shown are the Unicode code points (Unicode).

Common entities

Character Name Number Meaning
& & & Ampersand
< &lt; &#60; Less-than
> &gt; &#62; Greater-than
" &quot; &#34; Double quote
' &apos; &#39; Apostrophe (HTML5 and XML)
nbsp &nbsp; &#160; Non-breaking space
© &copy; &#169; Copyright
® &reg; &#174; Registered
™ &trade; &#8482; Trademark
€ &euro; &#8364; Euro
£ &pound; &#163; Pound
¥ &yen; &#165; Yen
¢ &cent; &#162; Cent
§ &sect; &#167; Section
° &deg; &#176; Degree
± &plusmn; &#177; Plus or minus
× &times; &#215; Multiplication
÷ &divide; &#247; Division
½ &frac12; &#189; One half
… &hellip; &#8230; Ellipsis
– &ndash; &#8211; En dash
— &mdash; &#8212; Em dash
‘ &lsquo; &#8216; Left single quote
’ &rsquo; &#8217; Right single quote / apostrophe
“ &ldquo; &#8220; Left double quote
” &rdquo; &#8221; Right double quote
« &laquo; &#171; Left angle quote
» &raquo; &#187; Right angle quote
• &bull; &#8226; Bullet
· &middot; &#183; Middle dot
← &larr; &#8592; Left arrow
→ &rarr; &#8594; Right arrow
↑ &uarr; &#8593; Up arrow
↓ &darr; &#8595; Down arrow
♥ &hearts; &#9829; Heart
✓ &check; &#10003; Check mark (HTML5)
ñ &ntilde; &#241; n with tilde
é &eacute; &#233; e acute
ü &uuml; &#252; u umlaut

The five you must escape

In HTML text, &, < and > must be escaped (&amp;, &lt;, &gt;). Inside a double-quoted attribute also escape " (&quot;), and in a single-quoted one ' (&#39;). Escaping on output is the main defence against Cross-site scripting (XSS) when you show user input.

Good to know

  • &nbsp; stops a line break between two words, for example in 10&nbsp;km. It is not a general layout tool.
  • Entities are decoded once. &amp;lt; shows the text &lt;, not <.
  • Numeric forms work for any code point; named ones exist only for a fixed list.
  • Always include the semicolon. Some old named entities work without it, but not reliably.
  • With UTF-8 pages you do not need entities for accented letters or the euro sign; type them directly.

Try these tools

See also

  • Glossary Unicode
    Unicode is the universal standard that gives every character in the world's writing systems, plus symbols and emoji.
  • Glossary Cross-site scripting (XSS)
    Cross-site scripting (XSS) is a vulnerability in which an attacker gets a website to deliver malicious script to other users' browsers.
  • Glossary UTF-8
    UTF-8 is the dominant Unicode encoding, writing each character as one to four bytes and staying identical to ASCII for the first 128.
  • Cheat sheet ASCII Table Cheat Sheet
    All 95 printable ASCII characters with decimal and hex codes, the control characters you will meet.
AdSense Placeholder
Slot: footer_leaderboard