正在加载,请稍候…

HTML Entities Cheat Sheet: Common Named and Numeric References

A quick HTML entities reference — the must-escape characters, common symbols and their named/numeric codes, and when you actually need to encode.

What HTML Entities Are

An HTML entity represents a character that is either reserved in HTML or hard to type. Entities come in three forms: named (&), decimal numeric (&), and hex numeric (&). All three render the same character.

The Must-Escape Characters

These five break HTML if left raw — escaping them prevents broken markup and cross-site scripting:

Char Named Numeric Why escape
& & & starts every entity
< &lt; &#60; starts a tag
> &gt; &#62; ends a tag
" &quot; &#34; ends an attribute value
' &#39; &#39; ends an attribute value (no &apos; in HTML4)

Common Symbols

Char Named Numeric Name
(nbsp) &nbsp; &#160; non-breaking space
© &copy; &#169; copyright
® &reg; &#174; registered
&trade; &#8482; trademark
&mdash; &#8212; em dash
&ndash; &#8211; en dash
&hellip; &#8230; ellipsis
&euro; &#8364; euro
£ &pound; &#163; pound
× &times; &#215; multiplication
÷ &divide; &#247; division
&rarr; &#8594; right arrow

When You Actually Need to Encode

  • Inside HTML content: escape <, >, and & so they show as text instead of being parsed.
  • Inside attribute values: also escape the quote character you're using (" or ').
  • You do NOT need entities for most Unicode if your page is UTF-8 — you can write or directly. Entities are for the reserved characters and for environments where you can't trust the encoding.

A frequent bug is double-encoding: escaping text that was already escaped, turning &amp; into &amp;amp;. Encode once, at output time.

Frequently Asked Questions

What are the 5 HTML entities I must escape? & (&), < (<), > (>), " ("), and ' ('). These are reserved and can break markup or enable XSS.

Do I need HTML entities for accented or Unicode characters? Not if the page is UTF-8 — you can type them directly. Entities are mainly for the reserved characters and unambiguous encoding.

What is the entity for a non-breaking space? &nbsp; (or &#160;). It renders a space that won't wrap or collapse.

Encode or decode entities instantly with the HTML entities tool, and see the full picture in the HTML Entities Guide.