HTML Entity Encoder/Decoder
Easily encode characters into HTML entities for safe web display, or decode encoded strings back to plain text. Prevents XSS and ensures correct rendering of special characters.
Common Entities
About the HTML Entities
Switch to Encode to turn characters like <, > and & into safe HTML entities, or to Decode to turn entities such as &lt; back into readable text.
Everything you enter is processed in your browser; nothing is uploaded or stored.
How to use it
- Choose Encode or Decode.
- Paste your text or HTML.
- Copy the result; use the Common Entities table for quick reference.
Why HTML entities are needed
Some characters have a special meaning in HTML: < and > open and close tags, and & starts an entity. To show them as text they must be written as <, > and &. Encoding also writes accented and other non-ASCII characters as numeric entities such as é for é.
Encoding user-supplied text before putting it into a page is a basic defence against HTML injection, and it is the only way to display code snippets inside HTML.
Example
<p>Tom & Jerry</p> encodes to <p>Tom & Jerry</p>, which a browser displays as the literal tag text.
Frequently asked questions
What is ?
A non-breaking space: it looks like a space but stops a line from breaking at that point.
Do I need to encode quotes?
Inside attribute values, encode the quote character used to delimit the attribute (" or ').
Is this the same as URL encoding?
No. URL encoding uses % codes (%20) for URLs; use the URL Encoder/Decoder for that.