Skip to content

Encoding & Transformation · free · no sign-up

HTML Encode

Convert special characters into HTML entities so they display safely on a web page.

How it works Report a problem

HTML Encode

Sanitize text with HTML entities

0
0
Source Text / HTML

About the HTML Encode

Convert special characters into HTML entities so they display safely on a web page.

How to use the HTML Encode

  1. Type or paste your text into Raw Chars.
  2. Press Encode Entities.
  3. Use Copy Result to copy the output, or download it if the button is shown.

Worked example

<p> becomes &lt;p&gt;.

Tips

  • Encoding user input helps prevent HTML injection, but you should also escape output in your own code.

Frequently asked questions

Why encode HTML?
So that characters like &lt; and &amp; show as text rather than being treated as code.