How to Use Symbols in HTML
Modern HTML documents can contain Unicode characters directly when the page uses UTF-8. Named or numeric character references remain useful for markup-sensitive characters, invisible spacing, and source-code clarity.
Best Ways to Enter Symbols
Literal UTF-8
Declare UTF-8 and place the character directly in text, such as © or →.
Named references
Use defined names such as ©, &, and .
Decimal references
Use © for © or any valid decimal Unicode value.
Hex references
Use © for ©; hexadecimal aligns naturally with U+ notation.
A Reliable Step-by-Step Method
- Declare UTF-8Place
<meta charset="utf-8">near the beginning of the document head. - Choose literal or referenceUse literal Unicode for readable text and references where escaping or source compatibility calls for them.
- Escape syntax charactersEncode ampersand and less-than when they are literal text.
- Validate the outputInspect the rendered page and source, especially around attributes and scripts.
Common Problems and Fixes
Text displays as mojibake
Ensure the file, server header, and meta declaration all use UTF-8.
An entity appears literally
Include the leading ampersand and final semicolon, and use a valid reference.
An ampersand starts an unintended entity
Write it as & in text and attributes.
A numeric reference is invalid
Use a valid Unicode scalar value rather than a surrogate or out-of-range number.
Accuracy and Workflow Tips
- Prefer literal UTF-8 for ordinary readable content.
- Always include the semicolon in character references.
- Do not use nonbreaking spaces merely to create visual indentation.
- Escape according to context: text, attribute, URL, CSS, and JavaScript have different rules.