Encode text as HTML character references so delimiters display as text.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
Characters that could be parsed as markup are replaced with named or numeric character references, selected for the surrounding text or attribute context. The HTML tokenizer resolves those references back to code points when parsing.
<script>alert("xss")</script>
<script>alert("xss")</script>
Templates, CMS content, and code samples encode literal HTML delimiters.