What are HTML entities?
HTML entities are escape sequences used to represent characters that have special meaning in HTML or that cannot easily be typed. An entity begins with an ampersand (&) and ends with a semicolon (;). For example, the less-than sign (<) must be written as < inside HTML, because the browser would otherwise interpret it as the start of an HTML tag.
There are three types of HTML character references: named entities like &, decimal numeric references like &, and hexadecimal references like &. All three forms produce identical output in the browser. Named entities are easier to read, while numeric references support any Unicode code point — even characters that have no named entity defined.
HTML entities in practice — common pitfalls
The most common HTML entity mistake is double-encoding: running already-encoded text through an encoder again, turning & into &amp;. This happens when a templating engine and application code both escape the same value. Always escape exactly once, at the point where data is inserted into HTML output.
A second pitfall is context confusion: HTML entities are not the right tool for URL-encoding (use percent-encoding instead) or for JSON strings (use JSON escape sequences). Each context — HTML, URLs, JavaScript strings — has its own escaping rules and they must not be mixed. This tool handles HTML entity encoding and decoding only; for URL encoding use the URL Encode / Decode tool, and for Base64 use the Base64 tool.