HTML Entities, Symbols & Special Characters
Why HTML Entities Exist
HTML uses certain characters as part of its own syntax. The angle brackets < and > define tags. The ampersand & starts entity references. The double quote " delimits attribute values. If you want to display these characters as visible text on your page rather than having the browser interpret them as code, you need a way to escape them. That is exactly what HTML entities do. An HTML entity is a special sequence that starts with an ampersand and ends with a semicolon, and the browser renders it as the corresponding character. Without entities, writing a math expression like "5 < 10" in HTML would break your page because the browser would interpret the less-than sign as the start of a tag.
The Essential Entities You Must Know
There are five entities that every HTML developer encounters regularly. These are not optional -- you will break your HTML if you use the raw characters in the wrong context. The ampersand entity & displays as &. The less-than entity < displays as <. The greater-than entity > displays as >. The double quote entity " displays as ". The non-breaking space creates a space that prevents line breaks between words.
Example: Essential HTML Entities
<!-- Displaying reserved characters safely -->
<p>In HTML, tags use < and > symbols.</p>
<p>Use & to write an ampersand in HTML.</p>
<p>Attribute values use "double quotes".</p>
<!-- Non-breaking space to prevent line breaks -->
<p>Mr. Smith earned $10 million.</p>
<!-- Showing code examples in text -->
<p>The <strong> tag makes text bold.</p>
The non-breaking space deserves special attention. A regular space allows the browser to break a line at that point during word wrapping. A non-breaking space forces the words on either side to stay together on the same line. Use it between titles and names (Mr. Jones), between numbers and their units (100 km), and between other word pairs that should never be separated by a line break.
Common Symbols and Special Characters
Beyond the required escape entities, HTML provides named entities for hundreds of commonly used symbols. These are especially useful for legal symbols, mathematical notation, currency signs, and typographic characters that are not easily typed on a standard keyboard.
Example: Symbol Entities
<!-- Legal and business symbols -->
<p>© 2026 Company Name</p> <!-- copyright -->
<p>Brand™ Product</p> <!-- trademark -->
<p>Brand® Registered</p> <!-- registered -->
<!-- Currency symbols -->
<p>Price: €50 / £45 / ¥7000</p>
<!-- Math symbols -->
<p>5 × 3 = 15</p> <!-- multiplication -->
<p>10 ÷ 2 = 5</p> <!-- division -->
<p>x ≠ y</p> <!-- not equal -->
<p>x ≤ 100</p> <!-- less than or equal -->
<!-- Arrows -->
<p>Next → Previous ←</p> <!-- right and left arrows -->
<p>Up ↑ Down ↓</p> <!-- up and down arrows -->
Numeric Character References and Unicode
Every character in Unicode has a numeric code point. You can use these code points directly in HTML using numeric character references. There are two formats: decimal references like © and hexadecimal references like © -- both render as the copyright symbol. Numeric references are useful when there is no named entity available for the character you need, or when you want to include characters from other writing systems without changing your file encoding.
Example: Numeric References and Unicode
<!-- Decimal numeric references -->
<p>© Copyright symbol</p>
<p>€ Euro sign</p>
<p>★ Star character</p>
<!-- Hexadecimal numeric references -->
<p>© Copyright symbol</p>
<p>€ Euro sign</p>
<p>★ Star character</p>
<!-- Direct Unicode characters (with UTF-8 encoding) -->
<p>Direct symbols: © € ★</p>
<!-- Characters from other scripts -->
<p>你好 means "hello" in Chinese</p>
When your HTML file uses UTF-8 encoding (which it should, as declared by <meta charset="UTF-8">), you can type most Unicode characters directly into your source code. However, there are still good reasons to use entities: they make your source code more readable when the character is visually ambiguous, they work reliably regardless of the text editor used, and they make it clear to other developers that the character was intentional.
Emoji in HTML
Modern browsers fully support emoji as Unicode characters. You can include them directly in your HTML source, use their decimal or hexadecimal code points, or copy them from an emoji reference. Since emoji are just Unicode characters, they work anywhere text is allowed -- paragraphs, headings, buttons, and even title tags.
Example: Emoji in HTML
<!-- Direct emoji characters (requires UTF-8) -->
<p>Rating: ⭐⭐⭐⭐⭐</p>
<!-- Using numeric references for emoji -->
<p>Thumbs up: 👍</p>
<p>Heart: ❤</p>
<p>Check mark: ✅</p>
<!-- Emoji in attributes -->
<button title="Add to favorites ❤">Like</button>
When to Use Entities vs Actual Characters
The decision of when to use HTML entities versus typing characters directly comes down to a few clear rules. You must always use entities for the five reserved characters (&, <, >, ", and ') when they appear in text content or attributes. You should use named entities for symbols that improve source code readability, such as © instead of the copyright symbol directly. You can safely type characters directly when your document uses UTF-8 encoding and the character is clearly visible and unambiguous in your source code. For currency symbols, mathematical symbols, and arrows, named entities often make the code more maintainable because any developer can instantly understand what → means, even without seeing the rendered output.
& instead of & will not work in all browsers. Always use the exact casing shown in the HTML specification. The most reliable approach is to use all lowercase for named entities.< in a code block can cause the browser to interpret the rest of your example as an actual HTML tag, completely breaking your page layout. entities to add visual spacing between elements. Non-breaking spaces are not a layout tool. If you need spacing, use CSS margin and padding properties instead. Using for layout creates accessibility problems and makes your code difficult to maintain.Practice Exercise
Create an HTML page that serves as a reference sheet for HTML entities. Build a table with three columns: the entity name, the entity code, and the rendered result. Include at least 15 different entities covering reserved characters, legal symbols, currency signs, math operators, and arrows. Add a section below the table that displays a code snippet showing how to properly escape HTML tags inside a paragraph. For example, show the text "The <img> tag is self-closing" rendered correctly using entities. Finally, add a footer with a copyright notice using the © entity and the current year.