HTML Encoder / Decoder
Encode special characters to HTML entities or decode them back. Real-time output — free, no sign-up.
Output appears here as you type...Common HTML Entities
What is HTML Encoding?
HTML encoding converts special characters into their HTML entity equivalents. This is essential when displaying user-generated content in a web page to prevent XSS (Cross-Site Scripting) attacks. For example, if a user types a script tag, HTML encoding converts it to a safe string that displays as plain text instead of executing as code.
Common characters that must be encoded include the ampersand, less-than sign, greater-than sign, and quotation marks. HTML decoding does the reverse — converting entity codes back to their original characters. Use this tool when building web applications, sanitizing user inputs or working with HTML templates.
Frequently Asked Questions
Why do I need HTML encoding?▼
HTML encoding prevents XSS attacks by converting special characters to safe HTML entities. It also ensures special symbols display correctly in all browsers.
What is the difference between & and &?▼
& is the raw ampersand character. & is its HTML encoded form. In HTML source code, always use & when you want to display an ampersand as text.
Does this tool work in real-time?▼
Yes. The output updates automatically as you type in the input box — no need to click any button.
Is this tool free?▼
Yes, 100% free. Works entirely in your browser with no data sent to any server.