What Are HTML Entities?
HTML entities are special codes that represent characters in HTML documents. They exist because certain characters have structural meaning in HTML — the less-than sign opens a tag, the ampersand begins an entity — and displaying these characters as literal text requires an escape mechanism.
Encode and decode HTML entities with WritePadPro's HTML Encoder & Decoder — paste any text and convert special characters to their entity equivalents, or paste encoded HTML to decode it back to readable text.
Every HTML entity starts with an ampersand and ends with a semicolon. Between them is either a name (named entity) or a number (numeric entity). The entity < renders as the less-than sign. The entity & renders as an ampersand. Without these entities, the browser would interpret these characters as HTML markup rather than displayable text.
HTML entities have been part of the web since the earliest versions of HTML in the early 1990s. While modern UTF-8 encoding has reduced the need for many entities, the five mandatory entities — for characters that would break HTML parsing — remain essential for every web developer.
Named vs Numeric Entities
HTML supports two formats for character entities: named and numeric.
Named Entities
Named entities use a descriptive word between the ampersand and semicolon. For example: & produces an ampersand, < produces a less-than sign, > produces a greater-than sign, © produces the copyright symbol, and — produces an em dash.
Named entities are easier to read and remember. HTML5 defines over 2,000 named entities, though most developers use only a small handful regularly.
Numeric Entities (Decimal)
Numeric entities use the character's Unicode code point as a decimal number. For example: & produces an ampersand (Unicode 38), < produces a less-than sign (Unicode 60), © produces the copyright symbol (Unicode 169).
Numeric Entities (Hexadecimal)
Same as decimal but using hex notation with an x prefix: & for ampersand, < for less-than, © for copyright, 🔥 for the fire emoji.
Which Format to Use?
| Format | Best For | Example |
|---|---|---|
| Named | Common characters with memorable names | © for copyright |
| Decimal | Characters without named entities | → for right arrow |
| Hexadecimal | When working with Unicode code points directly | → for right arrow |
Named entities are preferred for readability when available. Numeric entities cover any Unicode character. For URL-context encoding instead, see our URL Encoding Guide.
The 5 Mandatory HTML Entities
Encode these five characters whenever they appear in content that could be read as markup, especially user input. Strictly, & and < matter most in text content, and quotes matter inside attribute values, but encoding all five everywhere is the safe default. Skipping them can cause parsing errors, broken layouts, or security vulnerabilities.
| Character | Named Entity | Numeric | Why It Must Be Encoded |
|---|---|---|---|
| Ampersand | & | & | Starts entity sequences. Unencoded ampersand in text is interpreted as an entity beginning. |
| Less-than | < | < | Opens HTML tags. Unencoded less-than starts an HTML element. |
| Greater-than | > | > | Closes HTML tags. Encoding is required for validity and XSS prevention. |
| Double quote | " | " | Terminates attribute values. Unencoded quotes inside attributes break HTML and enable XSS. |
| Single quote | ' | ' | Terminates single-quoted attributes. Same XSS risk as double quote. |
The Security Dimension: XSS Prevention
Cross-Site Scripting (XSS) attacks work by injecting HTML or JavaScript into web pages. If user input containing a script tag is displayed without encoding, the browser executes the script. Encoding converts the dangerous characters to harmless entity text. Most modern frameworks and template engines (React, Django, Laravel Blade, Rails) escape user content by default when rendering it. WritePadPro's HTML Encoder & Decoder handles this conversion instantly.
Complete HTML Entity Reference
Below are the most commonly used HTML entities organized by category.
Typography Entities
| Entity | Description |
|---|---|
— | Em dash — used for parenthetical breaks |
– | En dash — used for ranges (1-10) |
… | Horizontal ellipsis |
“ / ” | Left/right double quotation marks |
‘ / ’ | Left/right single quotation marks |
| Non-breaking space |
· | Middle dot (interpunct) |
• | Bullet |
† / ‡ | Dagger / double dagger (footnote markers) |
¶ | Paragraph sign (pilcrow) |
§ | Section sign |
Currency Entities
| Entity | Description |
|---|---|
€ | Euro sign |
£ | British pound |
¥ | Japanese yen / Chinese yuan |
¢ | Cent sign |
¤ | General currency symbol |
Mathematical Entities
| Entity | Description |
|---|---|
× | Multiplication sign |
÷ | Division sign |
± | Plus-minus |
≠ | Not equal |
≈ | Approximately equal |
≤ / ≥ | Less/greater than or equal |
∞ | Infinity |
∑ | Summation |
√ | Square root |
° | Degree sign |
Arrow Entities
| Entity | Description |
|---|---|
← / → | Left/right arrow |
↑ / ↓ | Up/down arrow |
↔ | Left-right arrow |
⇐ / ⇒ | Left/right double arrow |
Legal and Intellectual Property
| Entity | Description |
|---|---|
© | Copyright |
® | Registered trademark |
™ | Trademark |
For previewing HTML with entities, use the HTML Preview tool. For another encoding guide, see our Base64 Guide.
When HTML Entities Are Required
1. Displaying Code in HTML
Showing HTML code as visible text requires encoding every tag. Without encoding, the browser interprets the tags as HTML and renders the content — not as visible code.
2. Preventing XSS Attacks
Any user-generated content displayed on a webpage must have the five mandatory characters encoded. This includes comment sections, forum posts, profile fields, search result excerpts, error messages that echo user input, and any dynamic content from databases.
3. Typographic Characters
Curly quotes, em dashes, en dashes, and ellipses should use entities or Unicode characters rather than their ASCII approximations. This produces better typography across all browsers and operating systems.
4. Non-Keyboard Characters
Characters not available on standard keyboards — copyright, registered trademark, trademark, euro, degree, multiplication, division, arrows — require either entities or direct Unicode input. Entities are more explicit and work reliably even in documents with ambiguous encoding settings.
UTF-8 vs HTML Entities
Modern web development uses UTF-8 as the default character encoding, which supports every Unicode character directly.
When UTF-8 Makes Entities Unnecessary
With UTF-8 encoding in your HTML, you can type most special characters directly — copyright symbol, euro symbol, em dash — without entities. The browser renders them correctly from the UTF-8 encoded bytes.
When Entities Are Still Required
- The 5 mandatory characters must always be encoded in text content and attribute values, regardless of UTF-8 support.
- Non-breaking spaces have specific semantic meaning — they prevent line breaks between words.
- HTML email — some email clients and sending systems still mishandle UTF-8, so entities can be safer for special characters.
- XML and XHTML — stricter parsing rules require entities for the mandatory five characters.
The Practical Recommendation
Use UTF-8 encoding for all documents (it is the HTML5 default). Use HTML entities for the 5 mandatory characters, non-breaking spaces, and any character that causes rendering issues. For everything else — accented letters, symbols, emoji — type the Unicode character directly.
Using WritePadPro's HTML Encoder
WritePadPro's HTML Encoder & Decoder converts between plain text and HTML-encoded text instantly.
Step 1: Open the Tool
Navigate to the HTML Encoder & Decoder. You will see an input area with Encode and Decode buttons.
Step 2: Encode Text
Choose Encode, paste any text containing special characters, and click Encode / Decode. The tool converts ampersands, less-than signs, greater-than signs, and double quotes to named entities, and single quotes to '. Tick "Encode non-ASCII characters and emoji as numeric entities" to also convert accented letters, symbols, and emoji to hex (the default) or decimal numeric entities.
Step 3: Decode Entities
Choose Decode, paste HTML-encoded text, and click Encode / Decode. The tool converts named, decimal, and hex entities back to their original characters. Any tags in the text stay as plain text and are never run.
Step 4: Copy and Use
Copy or download the result for HTML templates, CMS content fields, email HTML, or any context where special characters need escaping.
Privacy
All encoding and decoding runs locally in your browser. No text is transmitted to any server.
Summary
HTML entities represent special characters using codes that start with an ampersand and end with a semicolon. Named entities are readable, while numeric entities cover every Unicode character.
Five entities are mandatory for security and correct parsing: ampersand, less-than, greater-than, double quote, and single quote entities. Failing to encode these in user-generated content creates XSS vulnerabilities. Modern UTF-8 encoding reduces the need for most other entities, but the mandatory five remain essential.
Encode and decode HTML entities with WritePadPro's HTML Encoder & Decoder — instant conversion in your browser. For URL-context encoding, see our URL Encoding Guide. For binary-to-text encoding, see the Base64 Guide.