HTML Encoder
Encode and decode HTML special characters for safe embedding.
Input
Output
Encode: chars
Decode: chars
Quick Examples
Character Reference
& → &
< → <
> → >
" → "
' → '
& → &
→
© → ©
® → ®
™ → ™
<3 → <3
¢ → ¢
About the HTML Encoder
The HTML encoder replaces characters that have a special meaning in HTML, such as < and &, with safe codes like < and &, so text shows up as written instead of being read as markup.
How to use it
- 1 Paste text or HTML into the input.
- 2 Choose Encode or Decode.
- 3 Copy the safe output.
Frequently asked questions
Which characters need escaping in HTML?
At minimum: & (&), < (<), > (>), double quotes ("), and single quotes (') inside attribute values.
Does HTML encoding prevent XSS?
Escaping user input before putting it into HTML is a key defence against cross-site scripting, but you also need the right escaping for JavaScript, URLs, and CSS contexts.
What is the difference between this and the HTML Entity tool?
This tool escapes only the characters that must be escaped. The HTML Entity tool can also turn every non-ASCII character into a named or numeric entity.