Showing markup as text
To display a snippet of HTML on a web page — a tag, an attribute, an example — the special characters have to be escaped, or the browser renders them instead of showing them. Encoding turns<div> into <div>, which appears on the page as the literal text you meant.
Both directions, safely
Decoding reverses it, turning entities back into their characters — useful for reading escaped content pulled from a feed or an export. The decoder treats everything as inert text, so nothing in the input can run, and the whole conversion stays on your device.