HTML Entity Encode
This free HTML entity encoder escapes text so it can be embedded safely in HTML documents, XML feeds, code samples and CMS fields without breaking the markup.
How to use
- Paste the text or snippet that needs to be HTML-safe.
- The escaped result appears instantly; reserved characters become named entities.
- Optionally turn on escaping for all non-ASCII characters (… form).
- Copy the result; it was encoded in your browser and never left your device.
Frequently asked questions
Which characters get named entities and which get numeric ones?
Exactly five reserved characters use named entities: & becomes &, < becomes <, > becomes >, and the two quote marks become " and '. The convention is deliberately single-track. Only when you enable the non-ASCII option do other characters appear, and they always use the numeric … hexadecimal form.
Why does my apostrophe become ' instead of '?
Both are valid ways to escape a single quote. This tool standardizes on ', which is an official HTML5 entity and reads clearly in source code. Any HTML5 parser, browser or XML processor understands it, so there is no practical downside.
When do I need the escape-all-non-ASCII option?
Use it when your text will travel through systems with unreliable character encodings — legacy databases, mail pipelines or files that may be re-saved in a different code page. Emoji and CJK text become pure-ASCII numeric entities that cannot be corrupted by an encoding downgrade.
Can encoding run twice and produce &amp;?
No. The conversion is a single pass over your original text, so an input ampersand becomes exactly one & and stays that way. If you paste already-escaped text, the ampersands inside entities like & will be escaped again — decode it first if you want idempotent results.
Is my text uploaded anywhere?
No. Encoding happens locally in your browser as you type. Nothing is sent to a server, nothing is stored, and the result disappears when you close the page.
Related tools
About this tool
This free HTML entity encoder escapes text so it can be embedded safely in HTML documents, XML feeds, code samples and CMS fields without breaking the markup. Five characters have reserved meaning in HTML and are the usual source of broken pages: an ampersand that starts an entity, angle brackets that start and end tags, and double or single quotes that terminate attribute values. Paste your text and they become & < > " and ' in real time, using named entities for exactly those five characters — one consistent convention, no mixed named-versus-numeric output to second-guess. Need to protect emoji, accented letters or CJK text from encoding mismatches? Flip the escape-all-non-ASCII switch and every character above the ASCII range is written as a numeric … entity that survives any transport. The counter shows exactly how many characters were converted, and encoding never compounds: a single pass means an ampersand cannot be double-escaped. Everything runs locally in your browser as you type — nothing is uploaded, stored or logged. Paste, copy, done.