HTML Entity Encoder/Decoder

Encode special characters to HTML entities or decode entities back to readable text. Supports named and numeric entity formats.

Common HTML Entity Reference

Char Description Named Numeric
&Ampersand&&
<Less than&lt;&#60;
>Greater than&gt;&#62;
"Double quote&quot;&#34;
'Single quote / Apostrophe&apos;&#39;
 Non-breaking space&nbsp;&#160;
©Copyright&copy;&#169;
®Registered&reg;&#174;
Trademark&trade;&#8482;
Euro sign&euro;&#8364;
£Pound sign&pound;&#163;
¥Yen sign&yen;&#165;
¢Cent sign&cent;&#162;
Em dash&mdash;&#8212;
En dash&ndash;&#8211;
Bullet&bull;&#8226;
Horizontal ellipsis&hellip;&#8230;
«Left guillemet&laquo;&#171;
»Right guillemet&raquo;&#187;
Left arrow&larr;&#8592;
Right arrow&rarr;&#8594;
°Degree&deg;&#176;
×Multiplication&times;&#215;
÷Division&divide;&#247;

How to use the HTML Entity Encoder

Some characters (<, >, &, ", ') need to be encoded as HTML entities to render safely without breaking markup or creating XSS vulnerabilities. The encoder converts in both directions.

1

Paste your text

Source can be plain text (with characters that need encoding) or already-encoded HTML (to decode back to plain text).

2

Pick the direction

Encode — text → HTML entities. Decode — HTML entities → text.

3

Pick the encoding scope

Minimal — only the 5 unsafe characters (< > & " '). Aggressive — every non-ASCII character converted to numeric entity.

4

Copy the result

Paste encoded text into HTML attributes, body content, or anywhere user-generated text might appear.

Why HTML entity encoding matters for security and rendering

Unencoded user input is the #1 source of XSS vulnerabilities. A user typing <script> into a comment field can hijack your site if the text isn't entity-encoded before rendering.

The five characters that always need encoding

When entity encoding goes wrong

Frequently asked questions

What is HTML entity encoding?

Converting special characters (like <, >, &) to their entity equivalents (&lt;, &gt;, &amp;) so they render as text instead of being interpreted as HTML markup. Critical for any user-generated content displayed on a page.

Which characters need to be encoded?

At minimum the five XML-significant characters: < > & " and '. Inside HTML attributes, all of these. Inside body content, just < > &. Modern frameworks (React, Vue) auto-encode by default — the manual encoding requirement is mostly for legacy templates and raw HTML generation.

What's the difference between named and numeric entities?

Named entities use letter abbreviations: &copy; for ©. Numeric entities use Unicode codepoints: &#169; for the same © (decimal) or &#x00A9; (hex). Named entities are more readable but limited to a fixed set; numeric entities work for any Unicode character.

Do I still need to encode in modern frameworks?

Less often. React, Vue, Angular, and Svelte all auto-encode template content by default. You only need manual encoding when (1) using dangerouslySetInnerHTML or equivalent, (2) generating raw HTML strings server-side without a template engine, or (3) building HTML attributes from user data.

Does HTML entity encoding prevent XSS attacks?

It's a key defense layer. Encoding user-generated text before rendering it as HTML prevents script-injection. But encoding alone isn't enough — input validation, Content Security Policy, and proper attribute quoting are also required. Treat entity encoding as one piece of a defense-in-depth strategy.

Want AI-generated blog content that ranks? Try Autorank free.

Get Started Free →