HTML Entity Encoder / Decoder
Escape special characters for safe display in HTML, or turn entities such as & and © back into their characters.
How it works and known limits
What encoding changes
Encoding replaces the five characters that have special meaning in HTML: ampersand, less than, greater than, double quote and single quote. Each becomes a named entity such as & or <. This is what you need when displaying code samples or user text inside an HTML page.
How decoding works
Decoding uses the browser own HTML parser through a temporary element, so both named entities like © and numeric entities like 😀 are resolved the same way a browser would render them. Unknown entity names are left unchanged.
Known limits
Encoding is not a security filter on its own. It escapes text for display in an HTML text node, but it does not sanitise markup for attributes, JavaScript or URLs. Use a context-aware escaping library in application code rather than relying on this tool for untrusted input.
How to encode HTML entities (with screenshots)
Escape characters such as <, > and & into HTML entities, or decode them back to plain text.
Open the HTML Entity Encoder
Open the HTML Entity Encoder page. The text is where your work begins; the result appears on the right.
Enter your input
Paste text containing HTML special characters into the input box.
Run the tool
Click Encode to escape the special characters. The encoded result is safe to place in HTML source. Click Decode to turn entities back into characters.
Tip: Encoding user input before inserting it into HTML prevents it from being interpreted as markup.
Frequently asked questions
Which characters are encoded?
The five HTML special characters: &, <, >, " and '. They become named entities.
Does decoding support emoji entities?
Yes. Numeric references in decimal or hexadecimal form are decoded to the matching Unicode character.
Is my text sent anywhere?
No. Both encoding and decoding use built-in browser APIs and never leave your device.
Can I use the output to sanitise user input?
No. Entity encoding is for displaying text in an HTML body. Use a proper sanitizer for other contexts.
Page last reviewed: