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.
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: & → &,< → <, > → >, " → ",' → '. Encoding these characters prevents any user input from being interpreted as HTML markup or JavaScript event handlers.
This tool also decodes common named entities (©, , ™) 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.