HTML Encoder/Decoder — Free Online HTML Entity Encode Decode

Encode special characters to HTML entities (< > & ") and decode HTML entities back to plain text — prevents XSS vulnerabilities.

100% Client-Side — Your data never leaves your browser
0 chars
Output will appear here...
renders as visible text rather than executable JavaScript. This is context-specific — use HTML encoding for HTML content, URL encoding for URLs, and JavaScript encoding for JS strings. Never trust user input."}}]}

Frequently Asked Questions

HTML Entity Encoding and XSS Prevention

HTML entity encoding is a fundamental security control for web applications. When you display user-supplied input in an HTML page without encoding, an attacker can inject HTML tags or JavaScript — a Cross-Site Scripting (XSS) attack. Encoding converts dangerous characters into inert entity references.

The five critical characters for HTML context encoding are: & → &amp;,< → &lt;, > → &gt;, " → &quot;,' → &#x27;. Encoding these characters prevents any user input from being interpreted as HTML markup or JavaScript event handlers.

This tool also decodes common named entities (&copy;, &nbsp;, &trade;) and numeric entities (both decimal < and hex < formats). Use it for testing output encoding in templates, debugging HTML parsing issues, or preparing text content for insertion into HTML documents.

Related Tools