Encode text into HTML entities online for free with this HTML entity encoder. The tool converts reserved and special characters — angle brackets, ampersands, quotes, symbols — into their corresponding HTML entity codes so the text is safe to display inside an HTML document. Perfect for developers, content creators, and anyone publishing code snippets or user input on the web. Paste your text and get the encoded version in seconds.
Encoding is essential when you want to show HTML or code on a page rather than have it render — writing <div> requires encoding the angle brackets so the browser displays them instead of treating them as a tag. To reverse the process, use the HTML Entities Decoder.
An HTML entity encoder prevents two of the most common web bugs at once: broken rendering and cross-site scripting (XSS). When user input or code snippets are pasted into a page without encoding, characters like <, >, and & are interpreted as markup, which either mangles the display or, in the worst case, lets an attacker inject a script. Encoding those characters as named or numeric entities turns them into inert text.
This escape HTML online tool is also useful when writing documentation, blog posts, or tutorials that show source code — every tag, attribute, and inline script must be encoded so it appears as literal text rather than executing in the browser. Because the conversion runs entirely client-side, you can encode sensitive configuration, credentials, or proprietary markup without ever uploading it.
Reserved characters like <, >, &, and " become entity codes so they display as text instead of being parsed as markup:
<a href="x">Tom & Jerry © 2026</a><a href="x">Tom & Jerry © 2026</a> An HTML entity is an escape sequence that represents a character which is either reserved in HTML or hard to type. Reserved characters — <, >, &, ", and ' — have special meaning to the parser (they start tags or attributes), so to display them literally you must encode them. There are three forms: a named entity (<, ©), a decimal numeric entity (<, ©), and a hexadecimal numeric entity (<, ©). All three render identically.
Encoding is the foundation of safely displaying code samples and of basic XSS prevention. When you echo untrusted input into a page, encoding < and & stops an attacker from injecting a <script> tag that the browser would execute. Note that HTML entity encoding is a different job from URL encoding, which uses %-sequences for characters in a URL, and from Base64, which encodes arbitrary bytes — each scheme solves a different escaping problem.
The encoder lets you switch between named and numeric output, since some contexts (older email clients, certain CMSes) handle one form more reliably than the other. Numeric entities work for any Unicode code point, while named entities cover the common symbols. After tidying encoded markup you can compress it with the HTML Minifier or reformat it with the HTML Beautifier.
&): Encoding already-encoded text turns & into &amp;. Encode raw text once. %26) inside href attributes, not entity encoding.