HTML Entity Encoder / Decoder
HTML entities are special codes used to represent characters that have reserved meaning in HTML, such as angle brackets (< and >), the ampersand (&), quotation marks ("), and apostrophes ('). Encoding these characters ensures browsers render them as visible text instead of interpreting them as markup, which is essential for safely displaying user-generated content and code snippets on the web.
This tool performs two-way conversion: encoding transforms plain text into safe HTML by replacing reserved characters with their named or numeric entity equivalents (e.g. < becomes <), while decoding reverses the process and converts HTML entities back to readable text. It handles all five standard HTML escape characters as well as numeric entities in both decimal (A) and hexadecimal (A) form.
How it works
Encode: & → & | < → < | > → > | " → " | ' → '. Decode: browser-native textarea parsing, which resolves named entities, decimal (&#N;), and hex (&#xN;) forms.
Use cases
- Safely embedding user-generated content in HTML pages to prevent XSS injection
- Displaying source code or markup examples on a blog or documentation site
- Preparing text for use inside HTML attributes such as title, alt, or data-* fields
- Decoding obfuscated or encoded HTML snippets received from APIs or scraped pages
- Learning or teaching how browsers interpret HTML special characters and entities