Tools

Home
Regex TesterHash GeneratorURL Encode/DecodeEncrypt/DecryptJSON Path TesterFavicon Downloader

HTML Entity Encoder & Decoder

Encode special characters to HTML entities or decode entities back to characters

Your files never leave your browser
Input0 chars, 0 lines
Output0 chars, 0 lines
Ready·Mode: Encode | Special chars only | Named entities
Common HTML Entities Reference
CharacterNamedDecimalHexDescription
&&&&Ampersand
<&lt;&#60;&#x3C;Less than
>&gt;&#62;&#x3E;Greater than
"&quot;&#34;&#x22;Double quote
'&apos;&#39;&#x27;Apostrophe
 &nbsp;&#160;&#xA0;Non-breaking space
©&copy;&#169;&#xA9;Copyright
®&reg;&#174;&#xAE;Registered
™&trade;&#8482;&#x2122;Trademark
€&euro;&#8364;&#x20AC;Euro sign
£&pound;&#163;&#xA3;Pound sign
¥&yen;&#165;&#xA5;Yen sign
—&mdash;&#8212;&#x2014;Em dash
–&ndash;&#8211;&#x2013;En dash
«&laquo;&#171;&#xAB;Left guillemet
»&raquo;&#187;&#xBB;Right guillemet
•&bull;&#8226;&#x2022;Bullet
…&hellip;&#8230;&#x2026;Horizontal ellipsis

Convert special characters like <, >, &, and " into their HTML entity equivalents — or reverse the process to decode entities back to plain text. Pick named, decimal, or hex format and see results instantly as you type. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste Raw Text
➞
Match Reserved Characters
➞
Output Safe Entities

The tool reads each character in your input and checks it against a map of reserved HTML characters. When it finds a match — like <, >, &, or " — it replaces that character with the entity you selected: a named entity, a decimal numeric reference, or a hex reference. Non-matching characters pass through unchanged (unless you chose "all characters" mode, which encodes everything).

Examples

Showing HTML Code in a Blog Post

You want readers to see actual markup instead of the browser rendering it.

INPUT
<a href="https://example.com">Click here</a>
OUTPUT
&lt;a href=&quot;https://example.com&quot;&gt;Click here&lt;/a&gt;

Encoding an Ampersand in a URL Parameter

Ampersands inside href attributes break HTML validation if left raw.

INPUT
price=10&currency=USD
OUTPUT
price=10&amp;currency=USD

Protecting Special Symbols in Email Templates

Email clients are picky about rendering. A copyright symbol or em-dash can display as garbage if not encoded. Here the tool converts non-ASCII characters to numeric entities so every client shows them correctly.

INPUT
© 2026 Acme Corp — All rights reserved
OUTPUT
&#169; 2026 Acme Corp &#8212; All rights reserved

Who Uses This

👨‍💻 Web Developers

Encode user-generated content before injecting it into HTML templates to prevent XSS and rendering bugs.

✍️ Technical Writers

Display raw HTML tags inside documentation and tutorials without the browser swallowing them.

📧 Email Marketers

Convert special symbols to numeric entities so they render correctly across Outlook, Gmail, and Apple Mail.

🎓 Students

Quickly encode snippets for web-development homework without memorizing every entity name.

Common Mistakes

Double-encoding already-encoded text

If your text already contains &amp; and you encode it again, you get &amp;amp;. Decode first, then re-encode once from the raw version.

Encoding entire HTML documents instead of just the dynamic parts

Encoding your whole page turns every tag into visible text. Only encode the user-supplied values or the specific snippet you want displayed as code.

Forgetting to encode ampersands in URLs

A bare & inside an href attribute is invalid HTML. Validators will flag it. Always use &amp; between query parameters when writing them in markup.

Technical Details

Frequently Asked Questions

What is HTML entity encoding?

It is the process of replacing characters that have special meaning in HTML — like <, >, &, and " — with safe placeholders called entities. The browser reads the entity and displays the original character without trying to interpret it as markup.

When should I use named entities vs numeric entities?

Named entities like &amp; are easier to read in source code. Numeric entities (decimal or hex) cover a wider range of characters, including symbols that don't have named equivalents. For email HTML, numeric codes tend to be safer because some email clients don't support all named entities.

Does HTML entity encoding prevent XSS attacks?

Encoding is one layer of defense. When you encode user input before placing it inside HTML, injected script tags become visible text instead of executable code. That said, encoding alone isn't a complete security strategy — you still need input validation and a content security policy for proper protection.

What is the difference between HTML encoding and URL encoding?

HTML encoding replaces characters with HTML entities (like &amp;) so they display correctly in a web page. URL encoding (also called percent-encoding) replaces characters with percent codes (like %26) so they're safe inside a URL. Different contexts, different escape formats. Don't mix them up.

Is my text sent to a server when I use this tool?

No. The entire conversion happens in your browser using JavaScript. Nothing leaves your device — no network requests, no storage, no tracking. You can turn off your internet connection and the tool will still work fine.

Share: