HTML entity encoder & decoder
Escape and unescape HTML characters.
FreeRuns in your browserNo signupUpdated 2026-10-29
The five characters & < > " ' are always escaped. Pages served as UTF-8 do not need the rest, but encoding them is harmless.
Status
Escaped
Entities
14
In the output
Output length
151
+61 characters
<a href="/pricing?plan=pro&billing=yearly">Tom & Jerry's "best" deals – from £5 © 2026</a>
Quick reference
| Character | Named | Numeric | Use |
|---|---|---|---|
| & | & | & | Always, in text and attributes |
| < | < | < | Always in text, or it starts a tag |
| > | > | > | Safe to escape, rarely required |
| " | " | " | Inside double-quoted attributes |
| ' | ' | ' | Inside single-quoted attributes (' is HTML5 only) |
| non-breaking space | |   | Keep two words on one line |
About this tool
How it works and how to read the result.
Need this done for you?
Web app & SaaS development
SaaS products and web apps, from first version to scale.
See the serviceWhat it does
The HTML entity encoder escapes the characters that would otherwise be read as markup, so <script> becomes <script> and an ampersand becomes &. It can also encode every non-ASCII character, using a named entity such as é or — where one is common and a numeric reference such as ₹ otherwise, with an option to use numbers only. The decoder reverses all of it, including hexadecimal references like 🍺, and tells you if it met an entity name it does not know. Useful for template strings, RSS feeds, email HTML and checking what a page actually contains.
How to use it
- Choose Encode to escape text before it goes into a page or template, or Decode to turn entities back into characters.
- Paste the text. For encoding, decide whether to also encode non-ASCII characters and whether to use numeric references only.
- Copy the result. The quick reference table under the output lists the handful of entities you need most often.
How to read the result
The entity count shows how much was escaped. Encoding a link such as <a href="/pricing?plan=pro&billing=yearly">Tom & Jerry's "best" deals – from £5 © 2026</a> produces 14 entities: the tag brackets, the quotes, two ampersands, an apostrophe and, with non-ASCII encoding on, the dash, pound sign and copyright symbol. The output is about 60 characters longer than the input, which is normal.
If the decoded output still contains something like &bogus;, the status badge says how many unknown names were left as they were. A browser would do the same, so the text would show literally on the page.
When you paste a snippet from a page's source and the decoder returns <p> tags, that text was double-escaped somewhere: encoded once by a CMS and again by a template. Decoding twice restores it, but the real fix is to escape once, at the point of output.
Template escaping is one of the basics we check in web app development. To work with the structure rather than the characters, try the HTML formatter.
Questions
Frequently asked.
Which characters must I escape in HTML?
Ampersand and less-than always, because they start entities and tags. Inside attribute values, also escape whichever quote character wraps the value. Greater-than is safe to escape but rarely required. Everything else is optional on a page served as UTF-8, though encoding it does no harm.
Should I use named or numeric entities?
Both render the same. Named entities such as © are readable in source but only a few hundred exist and some old XML tools do not know them. Numeric entities such as © work everywhere. The numeric-only option is there for feeds, XML and email templates.
Is escaping the same as sanitising?
No. Escaping turns every special character into text, so a user's input can never become markup. Sanitising lets some HTML through and strips the dangerous parts. For comments and form fields, escape by default; it is simpler and it is what template engines do automatically.
Your next move
Like what you see? Tell us about it.
A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.
India · Working with clients worldwide