HTML Encode

HTML Encode

What this does

Replaces characters that HTML treats as markup with entities: < → &lt;, > → &gt;, & → &amp;, quotes → &quot;. 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 &amp;lt; to your readers.


Avatar

James Smith

CEO / Co-Founder

Enjoy the little things in life. For one day, you may look back and realize they were the big things. Many of life's failures are people who did not realize how close they were to success when they gave up.

Cookie
We care about your data and would love to use cookies to improve your experience.