Which characters must be escaped
Only a few characters can be misread as markup. An ampersand and a less-than sign need escaping in ordinary text, and a quote needs it inside an attribute that uses the same kind of quote.
On a UTF-8 page you can type é or € directly. Entities remain useful for invisible characters such as the non-breaking space, and for systems that only accept plain ASCII, such as some email templates and older databases.
What Encode and Decode do here
Encode writes a named entity for common characters such as &, <, © and €. Every other non-ASCII character becomes a decimal code, and emoji are handled as a whole, so 😀 becomes 😀.
Decode understands decimal codes, hex codes and the common named entities. An entity it does not recognize is left unchanged instead of being removed. Once you press a button, typing in the input box keeps using that mode.
Input: <a title="Tom & Jerry">© 2026</a>
Encoded: <a title="Tom & Jerry">© 2026</a>
Spotting double encoding
If a page literally shows &amp; or <b>, the text was escaped twice, often once by a form and again by a template. Decoding works in a single pass, so &lt; becomes < and stops there. Press Decode again on the output if you need to peel off a second layer.
Escaping is tied to context
Entities protect text placed inside HTML. They do not make a value safe inside a script block, a style rule or a URL, each of which has its own escaping rules. In a real application, let your template engine escape output, as Blade’s double braces or React’s JSX do, rather than encoding by hand.