HTML Entity Encoder/Decoder
Convert special characters to HTML entities and back
Plain Text
HTML Entities
Common HTML Entities
| Character | Entity Name | Entity Number |
|---|---|---|
| < | < | < |
| > | > | > |
| & | & | & |
| “ | " | " |
| ‘ | ' | ' |
| © | © | © |
| ® | ® | ® |
| (nbsp) | |   |
Frequently Asked Questions
How do I encode special characters as HTML entities to prevent XSS?
Paste the raw text containing characters like <, >, &, “, and ‘ into the Plain Text area and click Encode. The tool replaces each character with its HTML entity equivalent — < becomes <, > becomes >, & becomes &, ” becomes ", and ‘ becomes '. This encoding prevents the browser from interpreting the text as markup.
Is HTML entity encoding a complete XSS prevention strategy?
Entity encoding is an essential defense but not sufficient on its own. It works correctly for HTML content context (text inside element bodies). However, user input placed inside JavaScript strings, HTML attributes, CSS, or URL parameters requires different escaping strategies. Always apply context-specific output encoding and use a security-focused library or framework rather than relying solely on a single encoding pass.
How do I decode HTML entities back to readable text?
Paste the entity-encoded text (e.g., <div>) into the HTML Entities area and click Decode. The tool converts each named or numeric entity back to its corresponding character. This is useful when extracting text from HTML source, reading escaped strings in logs, or inspecting server-side output.
Is my text sent to a server when encoding or decoding HTML entities?
No. Both encoding and decoding run entirely in your browser using JavaScript DOM manipulation. No text is transmitted to any server, making it safe to paste sensitive content, authentication tokens embedded in HTML, or internal application markup.
What is the difference between named HTML entities and numeric character references?
Named entities use a human-readable identifier preceded by & and followed by ; — for example & for &. Numeric references use the decimal (&) or hexadecimal (&) Unicode code point. Named entities are limited to a defined set; numeric references can represent any Unicode character. Both are valid HTML5 and produce identical results in a browser.