HTML Entity Encoder
Encode text to HTML entities online: named entities for &, <, >, quotes plus numeric entities for the rest. Choose named or numeric — free and 100% private.
Encoded HTML
<a href="page">Tom & Jerry © 2026</a>
What is the HTML Entity Encoder?
The ByteTools HTML Entity Encoder converts text into HTML entities so it displays correctly and safely inside a web page.
- Named entities for &, <, >, " and ' plus common symbols
- Numeric &#nnn; entities for everything else
- Toggle between named and numeric output styles
- Optional encoding of all non-ASCII characters
- One-click copy of the encoded result
- 100% client-side — text never leaves your browser
How to use the HTML Entity Encoder
- 1
Paste or type your text into the input box.
- 2
Choose named entities (with numeric fallback) or numeric-only output.
- 3
Tick 'Encode all non-ASCII characters' if you need maximum portability.
- 4
Copy the encoded HTML from the result box.
- 5
Paste it directly into your page, template or attribute.
About the HTML Entity Encoder
The ByteTools HTML Entity Encoder converts text into HTML entities so it displays correctly and safely inside a web page. Reserved characters like &, <, >, single and double quotes are turned into named entities such as & and <, while other characters can be encoded as numeric references.
You choose the style: named entities where a friendly name exists (falling back to numeric for the rest), or purely numeric &#nnn; entities everywhere. An option to encode all non-ASCII characters is perfect for embedding accented letters, symbols and emoji into pages or email templates that expect plain ASCII.
Encoding happens entirely in your browser — nothing is uploaded. It is a quick, private way to prepare snippets for HTML, prevent markup from breaking, and reduce a common class of injection mistakes.
Frequently asked questions
What are HTML entities and why use them?
HTML entities are codes like & or © that represent characters which are reserved in HTML or hard to type. Encoding them ensures the browser displays the literal character instead of interpreting it as markup, which keeps your page from breaking.
Which characters must always be encoded?
At minimum the ampersand (&), less-than (<) and greater-than (>) signs, plus double and single quotes when the text sits inside an attribute. Encoding these prevents your content from being mistaken for tags or attribute boundaries.
What is the difference between named and numeric entities?
Named entities use readable words like © for ©, while numeric entities use the character's code point, such as ©. Named entities are easier to read but only exist for a subset of characters; numeric entities work for every character.
Should I encode non-ASCII characters like é or emoji?
It is optional. Modern UTF-8 pages display them fine as-is, but encoding non-ASCII characters as entities guarantees they survive systems that only handle plain ASCII, such as some email templates or legacy tools.
Does encoding HTML entities prevent XSS?
Encoding output that will be rendered as HTML is an important defence, but it is not a complete solution on its own. Always encode at the correct context (HTML, attribute, URL or script) and combine it with other server-side protections.
Is my text sent to a server?
No. The encoding runs entirely in your browser, so your content stays on your device and the tool works even without a connection.
Guides for HTML Entity Encoder
Related tools
HTML Entity Decoder
Decode HTML entities back to plain text: named entities, &#nnn; decimal and &#xhh; hex references. Free, instant and processed entirely in your browser.
HTML Formatter
Format HTML online with clean, consistent indentation. This HTML formatter handles void elements and preserves pre, script and style exactly. Free and private.
URL Encoder
Percent-encode text for URLs instantly. Switch between encodeURIComponent and encodeURI modes, see live output and copy the result. Free URL encoder.
String Escape / Unescape
Escape or unescape strings for JavaScript and JSON literals: quotes, backslashes, newlines, tabs and \uXXXX. Two-way, free and fully private in your browser.