HTML entity encoder & decoder
Encode special characters like <, >, &, " to HTML entities, or decode entities back to readable text. Prevents XSS when embedding user input.
Type something aboveWhat is HTML Entity Encoder & Decoder?
An HTML entity encoder converts special characters like angle brackets (<, >), ampersands (&), quotation marks, and backticks into their corresponding HTML entity representations. This is critical for web security because unencoded special characters in user-generated content can be interpreted as HTML or JavaScript by the browser, leading to Cross-Site Scripting (XSS) attacks. When you display user input on a web page, encoding these characters ensures they are rendered as visible text rather than executable code. The decoder does the reverse — converting HTML entities back to their original characters, which is useful when parsing HTML source code or extracting text from encoded content. This free tool handles both named entities and numeric entities, processing everything in your browser without sending data to any server.
How to Use HTML Entity Encoder & Decoder
- 1
Choose encode or decode mode
Select "Encode" to convert special characters into HTML entities, or "Decode" to convert HTML entities back into readable characters. Switch between modes using the toggle at the top.
- 2
Enter your text or HTML entities
Paste your raw HTML, user input, or entity-encoded string into the input field. The tool processes the input in real time and shows the converted output instantly below.
- 3
Copy the safe output
Click the Copy button to copy the encoded or decoded result. Use encoded output in your HTML templates to safely display user content without XSS risks.
Features
- Encodes all dangerous HTML characters including angle brackets and ampersands
- Decodes both named entities and numeric entities
- Prevents Cross-Site Scripting (XSS) by escaping user-generated content
- Real-time conversion with instant output as you type
- Processes entirely in the browser — no data sent to any server
- One-click copy to clipboard for quick use in your templates
Related Tools
JSON Formatter & Validator
Pretty-print and validate JSON with 2 / 4 space indentation.
JSON to CSV Converter
Convert JSON arrays to CSV format. Auto-detects columns, proper escaping, download as .csv.
CSV to JSON Converter
Convert CSV data to a JSON array of objects. Handles quoted fields and commas.
HTML Formatter & Minifier
Beautify messy HTML with proper indentation or minify it for production.
HTML Minifier
Minify HTML by stripping comments, collapsing whitespace. Shows size savings.
CSS Formatter & Minifier
Beautify CSS with proper indentation or minify it for production. Strips comments.