HTML Entity Encoder / Decoder

Convert special characters into HTML entities and back again.

Free, no sign-upRuns in your browserWorks on any device
0
Input Length
0
Output Length
0
Entities Found
XSS Prevention Tool | Encodes: & < > " ' `
Encode → HTML Entities
Decode ← HTML Entities
Input Text or HTML entities
Output Converted result
Waiting for input...
HTML Entity Reference
&&amp;
<&lt;
>&gt;
"&quot;
'&#39;
`&#96;
©&copy;
®&reg;
™&trade;
€&euro;
£&pound;
¥&yen;
¢&cent;
§&sect;
°&deg;
±&plusmn;

About the HTML Entity Encoder / Decoder

Characters such as <, > and & have special meaning in HTML. Encoding them as entities lets you display code safely on a web page and helps prevent cross-site scripting (XSS).

This tool encodes and decodes named and numeric entities instantly in your browser.

How to use the HTML Entity Encoder / Decoder

  1. Paste your text or HTML.
  2. Choose encode or decode.
  3. Select named or numeric entities if needed.
  4. Copy the result.

Key features

  • Named and numeric entities
  • Encode and decode
  • XSS-safe output
  • Live conversion

Why encoding HTML matters

Browsers treat < and > as the start and end of tags and & as the start of an entity. If you want to show code examples or user-provided text on a page, those characters must be written as &lt;, &gt; and &amp;. Otherwise the browser tries to interpret them, which can break the layout or, with untrusted input, run malicious scripts.

Named entities such as &copy; are easy to read, while numeric entities such as &#169; work for any Unicode character. Decoding converts both back into normal text.

Common uses

  • Showing HTML or XML code examples in blog posts and documentation.
  • Cleaning text copied from web pages that contains entities.
  • Escaping user content before inserting it into HTML.
  • Inserting special symbols such as ©, ™ and € safely.

Tips for the best results

  • Encode code snippets before pasting them into a CMS that renders HTML.
  • Rely on your framework's built-in escaping for user input in real applications.

Frequently asked questions

What is an HTML entity?

A code such as &amp;lt; that represents a character which would otherwise be interpreted as HTML.

Does encoding prevent XSS?

Encoding user input before displaying it is an important part of preventing XSS.

What is the difference between named and numeric entities?

Named entities use names like &amp;copy;; numeric ones use code points like &amp;#169;. Both display the same character.

Do I need to encode quotes?

Inside attribute values, yes: use &quot; or &#39; so the attribute is not cut short.

Is my text uploaded?

No. Conversion runs in your browser.

Related developer tools

View all →