What is the HTML Entity Encoder/Decoder?
This tool escapes characters that have special meaning in HTML — such as <, >, & and quotes — into entities like < and &, and decodes named and numeric entities back into readable text.
Optionally, non-ASCII characters can be converted into named entities (é) or numeric entities (é).
Why use it?
Showing code examples on a web page, inserting user-provided text into HTML, or reading text scraped from a page all require correct entity handling. Getting it wrong can break layouts or open cross-site scripting holes.
How to use the HTML Entity Encoder/Decoder
- Choose Encode or Decode.
- When encoding, decide how to treat non-ASCII characters and whether to escape quotes.
- Paste text and copy the result.
Examples
Displaying code in a blog post
<div class="box"> becomes <div class="box">, which displays literally instead of creating a div.
Cleaning scraped text
Fish & Chips — £9 decodes to Fish & Chips — £9.
Supported formats and inputs
- Named entities for common symbols and accented letters.
- Decimal (©) and hexadecimal (©) numeric entities for any Unicode character.
Limitations to know about
- The decoder includes the most common named entities, not all 2,000+ defined in HTML5. Unknown names are left unchanged.
- Escaping text is not a complete XSS defence; use your framework's templating, which escapes automatically, wherever possible.
Privacy
Everything is processed by JavaScript running in your browser tab. Your input is not sent to a server, logged or stored, so it is safe to use with configuration files and internal data. As always, avoid pasting production secrets into any website you do not control.
Frequently asked questions
Do I need to encode é or € on a UTF-8 page?
No. Modern pages declared as UTF-8 can include these characters directly. Only <, >, & and quotes in attributes must be escaped.
Is the decoded output rendered?
No. It is displayed as plain text in a text box, so any markup it contains cannot execute.
What is the difference between ' and '?
Both represent an apostrophe. ' is valid in HTML5 and XML but was not defined in HTML4, so ' is the most compatible choice.