HTML Entity Encode
Escape text so it can sit safely inside HTML. Minimal covers the five characters that break markup; All non-ASCII also converts everything above ASCII to numeric references.
Text
Escaped
About this tool
Text becomes markup the moment it contains an ampersand or an angle bracket, which is how a stray < turns the rest of a paragraph into an unclosed tag. Encoding replaces those characters with references the parser reads as literal text. The minimal set — ampersand, both angle brackets and both quote styles — is what you want for putting text into a page or a quoted attribute. The wider mode also escapes accented letters, symbols and emoji, for pipelines that cannot be trusted with UTF-8.
How to use it
- 1Paste the text you want to put inside HTML.
- 2Keep Minimal for normal page text, or pick All non-ASCII for a non-UTF-8 destination.
- 3Copy the escaped result straight into your template.
Frequently asked questions
›Which characters have to be escaped?
In page text, & and < are the two that genuinely break parsing. Inside an attribute value you also need the quote character in use. Escaping > and both quote styles as well is the safe habit, and that is what Minimal does here.
›Does escaping make user input safe to insert into a page?
It is necessary but not sufficient. Escaping these five characters is right for text and quoted attributes; it is not enough inside a <script> block, a style rule, or a URL attribute like href, where different rules apply. Prefer textContent or a template engine that escapes for you.
›When would I use the All non-ASCII mode?
When the output has to survive a channel that is not UTF-8 — an old email template, a legacy CMS field, or a file whose encoding you do not control. Every character above ASCII becomes a numeric reference that any parser can read.
›Named or numeric references?
Named ones like © read better; numeric ones like © always work, because a parser does not need to know the name. This page uses named references for the five HTML characters and numeric for everything else.