HTML Entity Encode/Decode
Instantly encode or decode HTML entities. Convert special characters like <, >, &, ", ' to HTML entities and vice versa. Free, fast, and runs entirely in your browser.
What are HTML entities?
HTML entities are special codes used to represent characters that have special meaning in HTML. They are written in the format &name; or &#number;. For example, < represents < and & represents &.
Why do I need to encode HTML entities?
Characters like <, >, &, " and ' have special meaning in HTML. If displayed as-is, they can break page layout or create security vulnerabilities like XSS (Cross-Site Scripting). Encoding them as entities ensures safe display.
What is the difference between named and numeric entities?
Named entities use human-readable names like < for < or & for &. Numeric entities use the character's Unicode code point, like < for < or & for &. Both produce the same result when rendered.
What are the five main HTML entities?
The five most common HTML entities are: & (&), < (<), > (>), " (") and ' ('). These correspond to characters that have syntactic meaning in HTML markup.
When should I use HTML entity encoding?
Use encoding when displaying user input on web pages, embedding code snippets, writing HTML tutorials, or any situation where special characters should be shown as text rather than interpreted as markup.
Is my data sent to a server?
No, all encoding and decoding is performed locally in your browser using JavaScript. Your data never leaves your device, ensuring complete privacy and security.
What characters get encoded?
The encoder converts the five key characters: & (ampersand), < (less than), > (greater than), " (double quote) and ' (single quote) to their corresponding HTML entities. All other characters remain unchanged.
Can I decode HTML entities back to text?
Yes, the decoder converts HTML entities like <, >, &, ", < and other named or numeric entities back to their original characters.
Does this tool handle Unicode characters?
Yes, the decoder supports all named HTML entities defined in the HTML5 specification, as well as numeric entities (both decimal &#NNN; and hexadecimal &#xHHH; formats) for any Unicode character.
What is HTML escaping?
HTML escaping is the process of replacing special characters with their entity equivalents to prevent them from being interpreted as HTML code. It's essential for web security and correct content display.
Can I use this tool for XSS prevention?
While HTML entity encoding is one layer of XSS prevention, proper security requires server-side sanitization and Content Security Policy (CSP) as well. This tool is great for understanding and testing entity encoding.