HTML Encode
What this does
Replaces characters that HTML treats as markup with entities: < → <, > → >, & → &, quotes → ". The text then displays literally instead of being interpreted.
When to use it
- Showing a code sample on a web page.
- Putting user input into HTML without letting it inject tags (basic XSS defence).
- Writing an attribute value that contains quotes.
Good to know
Encode once at the point of output. Encoding twice shows &lt; to your readers.