HTML Entity Encoder and Decoder
Escape and unescape HTML entities, named and numeric.
Use via API
Escape text as HTML entities, or decode named (&), decimal (&) and hex (&) character references back to text. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/html-entity-encoder-decoder
curl https://pithlab.com/api/v1/tools/html-entity-encoder-decoder \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"input":"<a href=\"/\">Café & Co</a>","mode":"encode","encoding":"named"}'About the HTML Entity Encoder/Decoder
Escape text for safe use in HTML, or decode entities like &, © and 😀 back to characters. Optional named or numeric encoding of non-ASCII text.
How to use the HTML Entity Encoder/Decoder
- Choose Encode or Decode.
- Type or paste your text. The result updates as you type.
- When encoding, choose whether to escape only the HTML-special characters or also every non-ASCII character.
- Copy the result or use Swap to send it back the other way.
Examples
Input
<a href="/search?q=fish&chips">Fish & Chips</a>
Output
<a href="/search?q=fish&chips">Fish & Chips</a>
Input
© 2026 – café 😀
Output
© 2026 – café 😀
Frequently asked questions
Which characters must be escaped in HTML?
In element content, & and < are the ones that matter, and > is escaped by convention. Inside attribute values you must also escape the quote character used to delimit the value. The basic mode escapes all five of & < > " ' so the output is safe in both places.
Does escaping make user input safe to insert anywhere?
No. Entity encoding protects HTML text and quoted attributes, but not URLs in href, inline JavaScript, CSS or unquoted attributes, which each need their own escaping. Use your framework's built-in escaping where possible.
Which named entities can it decode?
All 252 named entities from HTML 4 plus ', which covers the ones in common use, and every decimal or hexadecimal reference. Rarer HTML5-only names such as ✓ are left unchanged and listed so you can spot them.
Do I need entities for accented letters or emoji?
Not if your page is served as UTF-8, which almost all are. Encoding non-ASCII characters is only useful for systems that mangle anything outside ASCII.