HTML Encoder
Escape &, <, >, quotes, and apostrophes so the text is not treated as HTML markup.
About this tool
Each reserved character becomes a character reference, so the browser will show it instead of starting a tag or an attribute.
The page does not parse the text as a document and does not remove tags you meant to keep. Decode is the reverse for this same set.
How to use it
- Paste the text.
- Encode HTML.
- Copy the escaped text into HTML as text, not as a place where you wanted real tags.
Limitations
- The escaped characters are & < > " and '. Other characters are left as written.
- Encoding does not make a string safe for every context. A URL or a script string has its own rules.
Five characters become references
The replacements, in order
The encoder replaces ampersand, then less-than, then greater-than, then the double quote, then the apostrophe. Ampersand goes first so the replacements are not themselves escaped on the same pass. Less-than becomes <, greater-than becomes >, the double quote becomes ", and the apostrophe becomes ' rather than a named apostrophe entity. Every other character, including letters, digits, backticks, slashes, and non-ASCII letters, is copied through. What comes back belongs in an HTML text node or a quoted attribute, so the browser shows the characters instead of starting a tag.
That is a representation change for a markup context. It is not a cipher, and it does not hide the message from someone viewing source. It is also not a sanitizer for URLs, style attributes, or JavaScript string literals. Those contexts have their own special characters, and this pass does not know which context you will paste into.
What it will not strip
Existing tags are escaped, not removed and not parsed. If you meant to keep a real <b> element, this page is the wrong one: the brackets become references and the tag stops being a tag. The pass does not drop comments, scripts, or event-handler attributes, because it never builds a document. It also does not throw on ordinary input. An empty box encodes to an empty result. Encoding twice turns the ampersand of < into <, so the visible page would show the entity text rather than the character. One pass is the usual goal.
Round trip against the decoder
A single encode followed by the decoder restores the five characters, because ' is a numeric reference the decoder accepts and the four named entities are in its small name table. The spelling of the apostrophe will not round-trip if you start from a named apostrophe entity: the decoder turns that name into a character, and this encoder writes a numeric reference. Other named entities, such as a non-breaking-space name, are not produced here at all. If your source used them, encoding does not preserve them as names; they only survive if you never decode them first. Compare the decoded characters when you want the text back, not the exact entity spelling.
Privacy
Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.

