HTML entity encoder
This HTML entity encoder replaces characters that have a special meaning in HTML with entities, such as < for <. Web developers and writers use it to show code samples or user text on a page without the browser treating it as markup.
- Runs in your browser
- Free, no account needed
- Copy or download the result
Result
The short answer
HTML entities let you write characters that HTML would otherwise read as markup: & becomes &, < becomes <, > becomes > and quotes become " or '. Escaping text before placing it in a page stops it being read as a tag. It is escaping for display, not a cleaner for untrusted HTML.
Formula& to &, < to <, > to >, " to ", ' to '
Worked example<a title="Tea & coffee">Café</a> becomes <a title="Tea & coffee">Café</a>, with the é left as it is.
Example
<a title="Tea & coffee">Café</a>
<a title="Tea & coffee">Café</a>
How to use the html entity encoder
- Paste your text into the Text to escape box.
- Set Non-ASCII to Keep Unicode or Numeric entities.
- The escaped text updates as you type.
- Press Copy result or Download.
How it works
Five characters are always escaped: & becomes &, < becomes <, > becomes >, a double quote becomes " and an apostrophe becomes '.
Numeric entities writes every character above ASCII as a hex reference, so é becomes é.
The output is meant for an HTML text node or a quoted attribute value.
This is not an HTML sanitizer. It does not clean up HTML you want to keep, and it does not escape text for JavaScript, CSS or URLs.
An unpaired surrogate, which is half of an emoji left over after bad copying, causes an error.
Everything runs in your browser. Your input is not uploaded or stored. If you use Copy link, what you entered is placed in the link.
Questions and answers
Does escaping HTML prevent XSS?
Escaping helps against cross-site scripting (XSS) when you place untrusted text inside HTML text or a quoted attribute. It is not enough inside script tags, style blocks, event handler attributes or URLs, which need their own escaping.
Why convert non-ASCII characters to numeric entities?
Most modern pages handle Unicode fine. Numeric entities help when a file or system only accepts plain ASCII characters.
Why is the apostrophe written as '?
The numeric form ' works in every version of HTML, while the named form ' is not supported by some older HTML parsers.
Is my text sent anywhere?
No. Escaping runs in your browser, and you can turn the result back with the HTML entity decoder.
Last updated November 1, 2026. Maintained by SnowRock. How our tools work
All 220 SnowRock tools