HTML Entity Encoder
Encode and decode HTML entities online. Convert special characters to & < > © and more. Named, numeric, and hex encoding modes. Free, no signup.
Loading tool...
How to Use HTML Entity Encoder
- Choose Encode or Decode mode using the toggle
- Select an encoding mode: Named, Numeric, Hex, or All chars
- Paste or type your text into the input box
- The encoded or decoded result appears instantly in the output
- Click Copy to copy the result to your clipboard
- Use Swap to flip input and output and reverse direction
- Click any entry in the Quick Reference table to insert that character
About HTML Entity Encoder
The HTML Entity Encoder converts special characters to their HTML entity equivalents and decodes HTML entities back to plain text. Supports named entities (&, <, ©), numeric decimal (&), and hex (&) encoding modes. Includes a quick reference of the most common HTML entities with click-to-insert functionality.
Common Use Cases
Frequently Asked Questions
What are HTML entities?
HTML entities are codes used to represent characters that have special meaning in HTML, like < (<), > (>), and & (&). Without encoding, the browser would interpret these as HTML syntax. Entities tell the browser to display the character rather than interpret it.
When should I encode HTML entities?
Always encode user-generated content before rendering it as HTML to prevent XSS attacks. Also encode special characters in HTML attributes, XML documents, and when displaying code snippets or mathematical expressions.
What is the difference between named, numeric, and hex encoding?
Named entities use readable names (& © €). Numeric decimal uses the Unicode code point (& ©). Hex uses the code point in hexadecimal (& ©). All three are equivalent — browsers display them identically.
Does HTML entity encoding prevent XSS?
Encoding the five critical characters (<, >, &, ", ') is the foundation of XSS prevention when rendering untrusted content in HTML. Full XSS protection requires context-aware encoding — different rules apply in HTML attributes, JavaScript, and URLs.
Related Tools
HTML Minifier
Minify and beautify HTML code online. Remove comments, collapse whitespace, and optimize file size. Free tool with CSS/JS minification options.
URL Encoder & Decoder
Encode special characters for safe URL transmission or decode percent-encoded URLs. Free online tool for developers. No signup required.
JavaScript Beautifier
Beautify and minify JavaScript code online. Format messy JS with proper indentation, or compress for production. Free, fast, no signup required.