How to encode or decode HTML entities
- Choose Encode or Decode.
- Paste your text, HTML or entities into the input box.
- When encoding, choose whether to encode only special HTML characters or every non-ASCII character too, and pick the entity style.
- Copy the result, or click Swap to reverse it.
Why encode HTML entities?
Characters like <, > and & have special meaning in HTML. If you want to show them as text, for example to display a code example in a blog post, they must be written as entities: <, > and &. Escaping quotes also keeps values safe inside HTML attributes. This is a key step in preventing broken pages and cross-site scripting when inserting user content into HTML.
The non-ASCII option converts characters like é, ©, € and emoji into entities, which helps with old systems or email templates that don’t handle UTF-8 well. Named entities such as © are used where they exist; otherwise numeric entities like © or © are used. Decoding understands all named and numeric entities defined in HTML.
Safety: your input is always treated as plain text. It is never inserted into this page as HTML, and any scripts in it are never run, so you can safely paste untrusted snippets.
Common uses
- Showing HTML or XML code examples on a web page.
- Fixing text that shows
&or'instead of symbols. - Preparing text for HTML email templates.
- Escaping values before placing them in HTML attributes.
HTML entity FAQ
Which characters must be encoded?
At minimum &, < and > in text, plus quotes inside attribute values.
Named or numeric entities?
Both work in all browsers. Named entities are easier to read; numeric ones exist for every character.
Is encoding enough to prevent XSS?
Encoding is essential, but the right method depends on context (HTML, attributes, JavaScript or URLs). Use your framework’s built-in escaping in real applications.