Encode text into HTML entities instantly with our free HTML Entities Encoder. This 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.
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.