HTML Entity Encoder
Encode text to HTML entities (&, <, >, quotes) or decode entities back — with an optional mode for numeric references for all non-ASCII characters.
Reviewed 17 November 2026 · Free · No account needed
How to use
- Choose Encode or Decode.
- Optionally enable numeric entities for non-ASCII characters.
- Paste the text and copy the result.
Example
Input: Say "hi" & <b>bye</b>
Output: Say "hi" & <b>bye</b>
How it works
Encoding replaces characters such as <, > and & with their HTML entities (<, >, &), so the text displays literally instead of being read as markup.
Encoding replaces the five XML-critical characters (&, <, >, ", ') with their entities (& < > " '); an optional mode additionally turns every non-ASCII character into a decimal numeric reference (&#…;). Decoding resolves the common named entities plus all numeric references, decimal and hex.
Say "hi" & <b>bye</b> becomes Say "hi" & <b>bye</b>.
Edge cases to know
- Named decoding covers the common set (& < > " ' ' ); all numeric references decode regardless of name.
- The apostrophe encodes as the numeric ' rather than a named entity, for wider compatibility.
- This escaping is for text nodes and attributes — it is not a sanitiser and does not make untrusted HTML safe to render.
Limits & compatibility
- Encoding covers the five XML-critical characters plus the apostrophe.
- Named decoding covers the common set (& < > " ' ' ); all numeric references decode.
- This escaping is for text nodes and attributes — never paste untrusted HTML.
Privacy
All processing runs locally in your browser. Nothing is transmitted, logged or stored.
Related tools
Questions about HTML Entity Encoder
Which characters get encoded?
The five XML-critical characters — & < > " and the apostrophe, written as '. An optional mode goes further and converts every non-ASCII character to a decimal numeric reference, so é becomes é — useful when a downstream system cannot handle UTF-8. Anything outside these rules is left exactly as you typed it.
Which entities can be decoded back?
The common named set — & < > " ' ' — plus every numeric reference, whether decimal or hexadecimal. Lesser-known named entities such as © are not decoded, so text relying on the full HTML5 entity table will pass through partially untouched.
Is escaping enough to make untrusted text safe in my page?
For text nodes and attribute values, this escaping covers the characters that break out of those contexts. It is not a general security layer: never paste untrusted HTML and expect encoding to sanitise it — escaping constructs markup, it does not analyse it. Sanitisation needs a parser and an allow-list, which is a different job.