HTML Entity Encode & Decode Online
- This tool runs entirely in your browser. Nothing you enter or upload is sent to a server.
Text or HTML
Encoded
Result appears here.About this tool
Encode converts the characters that break markup — & < > " and ' — into entities such as & and <, so text can be shown safely inside an HTML page or attribute. You can also encode every non-ASCII character, using a name like © where one exists and a numeric reference otherwise.
For example, Tom & Jerry <b>"hi"</b> 'x' becomes Tom & Jerry <b>"hi"</b> 'x'. With the non-ASCII option on, ₹ 5 © é becomes ₹ 5 © é, because the rupee sign has no short name in the table and so gets a number.
Decode turns named entities (é, —, ), decimal references (₹) and hex references (₹) back into ordinary text. Unknown names such as &bogus; are left as they are rather than guessed. A common surprise is double escaping: text that already says &lt; decodes once to < and not to <, so decode again if you want the original.
Use it to prepare a code snippet for a blog post, to clean text copied from an email or CMS export, or to read an HTML source that is full of ’ and &. Remember that encoding for the page body is not the same as encoding for a URL or JavaScript string; for those use the URL Encoder / Decoder or the String Escape / Unescape tool. The tool works entirely in your browser with no uploads.
Frequently asked questions
Does encoding protect against XSS?
Escaping text before inserting it into HTML is a key part of preventing cross-site scripting, but the right escaping depends on the context (HTML body, attribute, URL, script). Use your framework's built-in escaping where you can.
What is the difference between ' and '?
Both mean an apostrophe. ' works in every HTML version, which is why it is used for encoding; ' is not recognised by very old HTML 4 parsers.
Which named entities can it decode?
The common ones — punctuation, currency, arrows, Greek letters and accented Latin letters. Any numeric reference decodes regardless of whether it has a name.
What is ?
A non-breaking space. It looks like a space but stops a line from wrapping there. Decoding turns it into that character, which can cause surprises when you search for a normal space.
Why did my text not change when I encoded it?
Plain letters and digits do not need escaping. Only & < > " and ' are encoded by default, so text without those looks the same unless you choose to encode non-ASCII characters too.