Why you escape HTML
Browsers treat certain characters as markup: < starts a tag, & starts an entity, and quotes delimit attributes. To show those characters as literal text — say, a code sample or a stray ampersand in a title — you replace them with HTML entities so the browser prints them instead of interpreting them.
Encoding also helps prevent broken layouts and a class of injection bugs, since user text can no longer be mistaken for tags. Decoding does the reverse, turning entities back into the original characters.
Worked example
The string <b>Tom & Jerry</b> encodes to:
< / >.&.<b>Tom & Jerry</b> — shows as text, not bold.Named vs numeric entities
Named entities like © and & are readable but only exist for specific characters. Numeric entities like © (decimal) or © (hex) work for any Unicode code point, which is why the "all non-ASCII" mode uses numeric form — it's universal. For most web use, escaping just the five essentials is enough.