HTML Entity Encoder / Decoder
Encode special characters to HTML entities or decode HTML entities back to text. Supports named entities (&), numeric entities (&), and hex entities (&). Essential for preventing XSS and displaying special characters.
How to Use the HTML Entity Encoder / Decoder
Select Encode or Decode mode, choose your preferred entity format (named, decimal, or hexadecimal), and paste your text. The output updates in real time. Named entities like& are the most readable. Decimal entities like & work universally. Hex entities like & are common in programming. Use the Swap button to quickly decode your encoded output. The reference grid at the bottom shows the most common HTML entities — click any to insert it into your input.
Why Encode HTML Entities?
HTML entity encoding is essential for web security and correct display. Characters like<, >, &, and " have special meaning in HTML. If user input containing these characters is displayed without encoding, it creates Cross-Site Scripting (XSS) vulnerabilities — one of the OWASP Top 10 security risks. Encoding converts these characters to safe entity references that browsers render as text instead of interpreting as HTML tags or JavaScript code. For URL and Base64 encoding, see our string encoder/decoder.
Common Use Cases
Sanitize user input before displaying in web pages. Encode special characters in HTML email templates. Prepare text content for embedding in XML or RSS feeds. Decode HTML entities from web scraping results. Display code snippets in HTML without the browser interpreting them as markup. Encode copyright symbols, trademark signs, mathematical operators, and typographic characters for reliable cross-browser display. Convert your encoded content from Markdown with our Markdown to HTML converter. All processing happens locally in your browser.