HTML Entities Encoder/Decoder
Encode special characters to HTML entities or decode them back. Handles &, <, >, quotes, and all named/numeric entities.
Common HTML Entities
About HTML Entities Encoder/Decoder
HTML entities are special character sequences that represent reserved or special characters in HTML documents. Characters like <, >, &, and quotes have special meaning in HTML and must be encoded when used as content rather than markup. Proper HTML entity encoding is the primary defense against Cross-Site Scripting (XSS) attacks -- one of the most common web security vulnerabilities -- because it prevents user-supplied content from being interpreted as executable HTML or JavaScript code.
HTML Entity Reference Guide
HTML entities come in three formats: named entities (& for &), decimal numeric entities (& for &), and hexadecimal numeric entities (& for &). The five mandatory entities for HTML safety are: & (ampersand), < (less than), > (greater than), " (double quote), and ' (apostrophe/single quote). Named entities are more readable but numeric entities can represent any Unicode character.
Beyond security, HTML entities are used for typography and special symbols: for non-breaking spaces (prevents line breaks between words), — for em dashes, © for copyright symbols, ™ for trademarks, and currency symbols like €, £, and ¥. Mathematical symbols (×, ÷, ±, ½), arrows (←, →, ↑, ↓), and typographic quotes («, », “, ”) are all available as named entities. This tool supports both standard encoding (escaping the five dangerous characters) and full encoding (converting all non-ASCII characters to numeric entities).
Frequently Asked Questions
What are HTML entities?
HTML entities are special codes used to represent characters that have special meaning in HTML (like < and >) or characters not available on the keyboard. They start with & and end with ;
When should I encode HTML entities?
Always encode user-generated content displayed in HTML to prevent XSS attacks. Characters like <, >, &, and quotes must be encoded when used inside HTML tags or attributes.