Convert special characters to HTML entities for safe display in web pages. Encode ampersands, angle brackets, quotes, and non-ASCII characters before inserting text into HTML.
Output will appear here.
Frequently Asked Questions
Why encode HTML entities?
Encoding prevents browsers from interpreting user text as HTML or JavaScript — essential for XSS prevention in templates.
Named vs numeric entities?
Named entities like < are readable. Numeric < works for any Unicode code point.
Does this sanitize HTML?
It encodes text for safe insertion. It does not strip tags from existing HTML markup.
Need to decode instead?
Use the HTML Entity Decoder to convert entities back to characters.
Is this tool free and does it work on mobile?
Yes on both counts. The HTML Entity Encoder on draft21 is completely free with no sign-up required and works on all devices.
Related Tools
HTML Entity DecoderDecode HTML entities to plain text.URL EncoderPercent-encode characters for URLs.Base64 EncoderEncode text to Base64.JSON FormatterFormat JSON for web config files.CSS MinifierMinify CSS before deployment.Developer & Web UtilitiesBrowse all developer and web utility tools on draft21.