Escape text into HTML entities so markup and user content display literally instead of executing.
Ctrl + Enter to run
Encoding converts characters that mean something to an HTML parser into entities, so `<script>` becomes text on the page instead of a script that runs. That substitution is the boundary between displaying user content and executing it, which makes it the foundation of cross-site scripting defence.
Use it whenever text you did not write ends up in markup — a code sample, a comment, a value pasted into a template. Note that entity encoding is for HTML context specifically; the same string placed inside a URL, a JavaScript literal or an attribute needs that context's own escaping instead.