HTML Entity Encode / Decode
Convert reserved HTML characters to entities and back.
Loading tool…
Encode reserved HTML characters (such as <, >, & and quotes) into safe HTML entities, or decode entities back to plain characters. It is useful for displaying code snippets on a web page or cleaning up pasted content. Everything runs in your browser.
Showing characters the browser wants to interpret
A browser reading a less-than sign expects a tag to follow. So if you want to display a less-than sign as text, or show someone a snippet of HTML on a page, you have to escape it. Entities replace the character with a code the browser renders as the symbol rather than acting on it. That is why documentation sites and tutorials can print HTML without the browser trying to run it.
The security side of the same idea
This is not only about display. If a site takes text from a user and puts it into a page without escaping it, someone can submit a script tag that then executes for everyone who views it. That is cross site scripting, and escaping output is the primary defence. Any modern framework escapes by default, which is exactly why deliberately bypassing that default is dangerous.
The ones you meet most
- Less-than and greater-than become < and >
- Ampersand becomes &, and it must be escaped first or you double encode everything else
- Double quote becomes ", which matters inside HTML attributes
- Non-breaking space is , which stops a line breaking at that point
How to use HTML Entity Encode / Decode
- 1
Paste your text or HTML.
- 2
Choose Encode or Decode.
- 3
Copy the result.
Frequently asked questions
So special characters display as text instead of being interpreted as HTML tags.