HTML Entity Encoder and Decoder
Turn the special characters of HTML into entities, or turn entities back into plain characters.
HTML entities
Choose encode or decode and paste text.
Result
Result
<a href="x">Tom & Jerry's café</a>
Private: Everything runs in this page. Nothing you type is sent anywhere or saved.
On this page
Entity examples
| Text | Encoded (basic) | Encoded (numeric) |
|---|---|---|
| <b>bold</b> | <b>bold</b> | <b>bold</b> |
| Tom & Jerry | Tom & Jerry | Tom & Jerry |
| 5 > 3 | 5 > 3 | 5 > 3 |
| say "hi" | say "hi" | say "hi" |
| café €5 | café €5 | café €5 |
Formula
& becomes &, < becomes <, > becomes >, " becomes ", ' becomes '
How the html entities works
- Step oneChoose Encode or Decode.
- Step twoWhen encoding, choose how far to go: only the five characters that break HTML, or more.
- Step threeCopy the result. Decoding handles names such as & and numbers such as A and A.
What this tool does not do
- Encoding is not a full defense against injection; the right escaping depends on where the text goes (HTML text, attribute, script, URL).
- Decoding knows about 50 common entity names, not all 2,200 in the HTML standard.
- It works on plain text and does not parse or clean up HTML.
Frequently asked questions
Which characters must always be encoded?
In text that is put into HTML, the ampersand and the less-than sign. In attribute values, the quote marks that surround the value are needed as well. Encoding all five is the safe default.
Does decoding twice undo double encoding?
Decoding runs once. &lt; becomes <, which is what the original text said. Run it again only if you want the next layer removed.
Why are some names left unchanged?
The tool knows the most common named entities (about 50). Names it does not know are left as they are and counted in the note.