HTML Entities — Encode & Decode Special Characters for Correct, Safe HTML
Learn what HTML entities are, why they exist, the most common named entities, how numeric entities work for any Unicode character, and when modern UTF-8 pages don't need them — with a free HTML entities tool.
By sadiqbd · June 7, 2026
HTML entities are what keep your web page from breaking when displaying special characters
The browser interprets <, >, and & as HTML syntax characters. If your content includes these characters literally — a code example showing <div>, a mathematical expression with &, a price with < or > — the browser either misinterprets them or renders the page incorrectly. HTML entities are the solution: escaped representations of these characters that the browser displays correctly without misinterpreting as markup.
Why HTML Entities Exist
HTML is a text format that uses <, >, and & for structure. This creates a problem when you want to display these characters as content:
<p>Price: 5 < 10</p>— the<might confuse the parser<p>Company: Johnson & Johnson</p>— the&might be misinterpreted as starting an entity<code><div class="container"></code>— this is how you safely display HTML code in HTML
HTML entities are the escape mechanism:
<displays<>displays>&displays&"displays"'or'displays'
Common HTML Entities Reference
Essential characters
| Character | Named entity | Numeric (decimal) | Numeric (hex) |
|---|---|---|---|
< |
< |
< |
< |
> |
> |
> |
> |
& |
& |
& |
& |
" |
" |
" |
" |
' |
' |
' |
' |
(space) |
|
  |
  |
Typographic characters
| Character | Entity | Use |
|---|---|---|
© |
© |
Copyright |
® |
® |
Registered trademark |
â„¢ |
™ |
Trademark |
€ |
€ |
Euro sign |
£ |
£ |
Pound sterling |
— |
— |
Em dash |
– |
– |
En dash |
… |
… |
Ellipsis |
" |
“ |
Left double quote |
" |
” |
Right double quote |
· |
· |
Middle dot (bullet) |
× |
× |
Multiplication sign |
÷ |
÷ |
Division sign |
Mathematical symbols
| Character | Entity |
|---|---|
≤ |
≤ |
≥ |
≥ |
≠|
≠ |
± |
± |
° |
° |
½ |
½ |
¼ |
¼ |
¾ |
¾ |
∞ |
∞ |
How to Use the HTML Entities Tool on sadiqbd.com
Encoding (text to entities):
- Paste text containing special characters
- The tool converts characters like
<,>,&,"to their HTML entity equivalents - Copy the encoded HTML-safe output
Decoding (entities to text):
- Paste HTML with entity codes
- The tool converts entities back to the actual characters
- Copy the decoded text
Real-World Examples
Displaying code in HTML
You're writing documentation and want to show this HTML snippet:
<div class="container">
<p>Hello & welcome</p>
</div>
In HTML, you'd need to encode this before putting it in <pre><code> tags:
<pre><code><div class="container">
<p>Hello & welcome</p>
</div></code></pre>
Without encoding, the browser would try to render the inner HTML as actual HTML elements.
Company names with ampersands
Johnson & Johnson, AT&T, Marks & Spencer — these contain & which must be encoded in HTML:
<p>Johnson & Johnson</p>
<p>AT&T</p>
Most modern HTML parsers are forgiving about bare & in content, but it's technically incorrect and can cause issues in XML-based contexts (XHTML, SVG, XML feeds).
Email templates
HTML emails are parsed by many different email clients with varying levels of strictness. Using proper entity encoding for &, <, >, and special characters ensures consistent rendering across Gmail, Outlook, Apple Mail, and mobile clients.
Database-stored HTML
When users submit content that gets stored in a database and later displayed as HTML, all user input must be entity-encoded before display to prevent XSS (Cross-Site Scripting) attacks:
User input: <script>alert('hacked')</script>
Stored and encoded: <script>alert('hacked')</script>
Browser displays: <script>alert('hacked')</script> — as text, not executed
This is the core of output encoding for XSS prevention.
Mathematical content
A page comparing prices: "The sale price is less than < the original." In HTML:
<p>The sale price is less than < the original.</p>
Or using the character directly: in HTML5, a bare < in text content (not inside a tag) is generally safe — but using < is more robust and universally correct.
Named Entities vs. Numeric Entities
Every character representable as an HTML entity has both named and numeric forms:
Named: & — human-readable, well-known for common characters
Numeric decimal: & — works for any Unicode character, not just named ones
Numeric hex: & — hexadecimal form, same coverage as decimal
For characters without named entities (e.g., Bangla characters, emoji), use numeric form: ন for প (Bengali letter pa).
When NOT to Use HTML Entities
Modern HTML5 UTF-8 pages don't need entities for most characters. If your page declares <meta charset="UTF-8"> and is served with the correct encoding header, characters like é, ñ, ü, and even Bengali characters can be used directly in source — no entities needed.
Entities are primarily needed for:
- The five reserved characters:
<,>,&,",' - Invisible characters where the literal character would be confusing (non-breaking space
) - Legacy encodings or contexts where UTF-8 isn't guaranteed
Frequently Asked Questions
What's the difference between " and "?
Both represent the double quote character ". Named entities (") are more readable; numeric entities (") work for any Unicode character. Use named where available for readability.
When should I use instead of a regular space?
When you need a space that doesn't allow line breaking — such as between "Mr." and "Smith" (preventing a line break between the title and name), or before a unit like "50 kg." Use sparingly; non-breaking spaces in unexpected places cause layout and copy-paste issues.
Is the HTML entities tool free? Yes — completely free, no sign-up required.
HTML entities are one of the fundamentals that separates correctly written HTML from HTML that mostly works. The entities tool makes encoding and decoding any set of special characters immediate.
Try the HTML Entities tool free at sadiqbd.com — encode or decode any text with HTML entities instantly.