HTML entities are escape sequences that let you include reserved or non-ASCII characters in HTML without breaking the markup. For example, < renders as a literal less-than sign instead of starting a tag. This free tool converts text to entities and back, helping you debug templates, sanitise attribute values, or prepare characters for an HTML email.
When you need encoding
Encoding is necessary whenever you insert dynamic or user-supplied text into an HTML document. Without it:
- A value containing
<script>could execute as markup (XSS). - A value containing
"inside a double-quoted attribute could close the attribute prematurely. - A value containing
&could corrupt an adjacent entity sequence.
The pure-ASCII mode (encoding all non-ASCII characters as numeric references) adds a second guarantee: the output is safe regardless of the character encoding the server declares. This is particularly useful for HTML emails, where mail clients and gateways have historically been less reliable than browsers about character encoding.
How it works
When encoding, the tool walks your text one character at a time. The five HTML-significant characters — &, <, >, " and ' — are replaced with their named entities. If you enable the non-ASCII option, every character above code point 127 becomes a numeric reference &#NNN; derived from its Unicode code point, producing pure-ASCII output.
When decoding, the tool matches each &...; sequence and resolves:
- Named entities (e.g.
©→©,—→—) - Decimal numeric references like
€→€ - Hexadecimal numeric references like
€→€
& is resolved last to avoid double-decoding — so a literal &lt; in your input becomes < (the entity text), not < (the character).
Worked examples
Encoding user input for display in HTML:
Input: Tom & Jerry <classics>
Output: Tom & Jerry <classics>
Encoding for an HTML attribute value:
Input: I said "hello" & waved
Output: I said "hello" & waved
Decoding an entity-laden template string:
Input: © 2026 — café au lait
Output: © 2026 — café au lait
Quick entity reference
| Character | Named entity | Decimal |
|---|---|---|
& | & | & |
< | < | < |
> | > | > |
" | " | " |
' | ' | ' |
© | © | © |
€ | € | € |
— | — | — |
All encoding and decoding runs entirely in your browser — nothing you enter is sent to a server or stored anywhere.