How to Use HTML Character References in Your Web Pages
Every HTML document can reference any Unicode character—whether or not you can type it on your keyboard—using character references. Mastering them makes your HTML more portable, readable, and resilient to encoding mishaps. The complete list of named references is available in the HTML entities reference.
Three Ways to Write a Character Reference
HTML gives you three forms:
- Named entity:
©→ © — human-readable, defined by the HTML spec - Decimal numeric reference:
©→ © - Hexadecimal numeric reference:
©→ © — mirrors the U+00A9 codepoint notation directly
All three produce identical output. Use the form that's most readable in context. For characters without a named entity—like the interrobang U+203D ‽—use a numeric reference: ‽.
Characters You Must Always Escape
In HTML content, only three characters require escaping to prevent them from being interpreted as markup:
<→<(starts a tag)>→>(ends a tag)&→&(starts a character reference)
In attribute values delimited by double quotes, you must also escape " as ". Single-quoted attribute values must escape ' as '.
Modern Best Practice: Just Use UTF-8
With a <meta charset="UTF-8"> declaration in your document and a UTF-8 encoded file, you can include any Unicode character directly—no escaping needed. <p>The price is €49.</p> is perfectly valid and preferred over <p>The price is €49.</p>. Reserve character references for the three mandatory cases above, for characters that are hard to type, and for anywhere the character might be misread by another developer (an em dash at the end of a line can look like a hyphen in some editors).
Use the character comparison tool to quickly get the entity and numeric reference for any two characters.