HTML Encoder/Decoder
Encode and decode HTML entities for safe display
Input
Output
Common HTML Entities
&
&
Ampersand
<
<
Less than
>
>
Greater than
"
"
Double quote
'
'
Single quote
␣
Non-breaking space
©
©
Copyright
®
®
Registered
™
™
Trademark
€
€
Euro
£
£
Pound
¥
¥
Yen
—
—
Em dash
…
…
Ellipsis
←
←
Left arrow
→
→
Right arrow
•
•
Bullet
°
°
Degree
Examples
Before Encoding:
<script>alert("Hello & World")</script>After Encoding:
<script>alert("Hello & World")</script>Frequently asked questions
Why do I need to encode HTML?
HTML encoding prevents browsers from interpreting characters as code. Essential for security (prevents XSS attacks), displaying code examples, and showing characters like <, >, &, and quotes literally.
What characters must be HTML encoded?
At minimum: < (< or <), > (> or >), & (& or &), " (" or "), and ' (' or '). Encode anything that could be interpreted as HTML.
Should I encode all user input?
Yes, always encode user-provided content before displaying in HTML. This is your primary defense against XSS attacks. Modern frameworks often handle this automatically.