HTML Encoder & Decoder | Free Online HTML Entity Converter
Encode HTML special characters to entities and decode them back. 100% free, works in browser — no data sent to server.
Online HTML encoder and decoder tool
HTML Text
Result
HTML Entities & XSS Prevention Guide
HTML entity encoding converts reserved characters into character entity references, preventing web browsers from misinterpreting raw text as executable HTML markup.
Critical Safe Characters Table
& & Ampersand
< < Less-than (starts an HTML tag)
> > Greater-than (ends an HTML tag)
" " Double quotation mark (attributes)
' ' Single quote / Apostrophe
© © Copyright symbol
€ € Euro currency signPreventing Cross-Site Scripting (XSS)
If user-submitted data containing <script> is echoed directly into an HTML template without entity encoding, the browser executes the script as code. Encoding converts < to < so the browser displays the literal characters safely as text.
Named vs Numeric Entities
Named entities like " are easy for humans to read. Numeric entities like " (decimal) or " (hex) are guaranteed to be recognized across older XML and strict XHTML parsers.
HTML Encoding vs URL Encoding
HTML encoding converts characters into entities for web page rendering (e.g. &). URL encoding converts characters into percent-escapes (e.g. %26) for query strings and HTTP request transmission. Use HTML encoding for markup, URL encoding for links.
Frequently Asked Questions
How do I encode HTML special characters online?
Paste your raw HTML or text into the encoder input. The tool instantly converts characters like <, >, &, ", and ' into their safe HTML entity equivalents (<, >, &, ", ').
When should I encode HTML entities?
You should encode HTML entities whenever you display user-generated content in a web page to prevent cross-site scripting (XSS) attacks. It ensures that browser interprets the characters as text, not markup.
What is the difference between HTML encoding and URL encoding?
HTML encoding converts characters to HTML entities for safe display in web pages (e.g., & becomes &). URL encoding converts characters to percent-encoded sequences for safe transmission in URLs (e.g., & becomes %26).
Does this tool support all HTML named entities?
This tool handles the five most critical HTML entities: <, >, &, ", and '. These cover the vast majority of XSS prevention use cases for rendering user content safely.