HTML Entity Encode
Escape &, <, >, quotes and optionally all non-ASCII characters as HTML entities so text is safe to embed in HTML.
Paste or drop
Paste text below, or drop a file instead.
Choose an output
Escape &, <, >, quotes and optionally all non-ASCII characters as HTML entities so text is safe to embed in HTML.
Fine-tune
Optional — sensible defaults are already set.
About HTML Entity Encode
Escape the characters that have special meaning in HTML so text shows up as written instead of being read as markup. The five reserved characters &, <, >, " and ' are always encoded. You can also encode every non-ASCII character, using named entities like é where they exist and numeric codes otherwise.
When it helps
- Showing code samples containing tags inside a blog post or documentation page.
- Putting user-supplied or copied text into HTML attributes and templates without breaking them.
- Making accented text and symbols safe for systems that only handle ASCII, such as some email tools.
- Preparing text for XML or RSS feeds where & and < must be escaped.
Tips
- The apostrophe is encoded as the numeric ', which works in every version of HTML, unlike '.
- Only turn on 'Also encode non-ASCII characters' when the target cannot handle UTF-8. Modern pages served as UTF-8 display é and emoji fine as they are.
- Turn off 'Prefer named entities' to get numeric codes for everything, which some XML parsers need because they only know the five basic named entities.
- Encode text once only. Running it twice turns & into &amp;, which then shows up on the page.
Good to know
Quick answers about html entity encode in your browser.
In text content, & and < must be escaped. Inside attribute values, the quote character used around the value must be escaped too. Encoding all five reserved characters everywhere is the safe habit.
Encoding for HTML text and quoted attributes is a key part of preventing cross-site scripting. It is not enough on its own for JavaScript strings, URLs or CSS, which need their own escaping.
Yes. There is no sign-up, no watermark and no limit on how many files you process.
No. Files are read and processed locally in your browser, so they never leave your device.
Related tools
Part of the Text Tools collection.