HTML Encoder

Escape &, <, > and quotes into HTML entities so text can be shown safely inside markup. Runs entirely in your browser.

HTML or text

Paste markup to escape

Escaped output

Result

What is HTML encoding?

HTML encoding replaces characters that have a special meaning in markup with named or numeric entities. An ampersand becomes &amp;, a less-than sign becomes &lt;, and so on.

It is used to display code samples, user comments and any text that would otherwise be interpreted as tags by the browser.

How to escape HTML

  1. Paste the HTML or plain text you want to escape.
  2. Press Encode HTML.
  3. The five characters &, <, >, " and ' are converted to entities.
  4. Copy the escaped result into your template.

HTML encoding examples

A link

<a href="#">Home</a>
&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;

An ampersand

Tom & Jerry
Tom &amp; Jerry

A script tag

<script>
&lt;script&gt;

Browser encoder vs other ways

DimensionUrsaKit HTML EncoderHand-editing entitiesTemplate helpers
Characters coveredThe five dangerous onesEasy to miss oneDepends on the framework
Round tripPairs with the decoderManualOften
Data leaves the deviceNo, runs in the browserNoDepends on the app
FAQ

Frequently asked questions

Is the HTML encoder free?

Yes, with no account and no limit.

Which characters are escaped?

&, <, > and both quote characters. Those are the characters that change how a browser parses markup.

Is it the same as URL encoding?

No. HTML encoding produces entities like &amp;, while URL encoding produces percent sequences like %26.

Does it prevent XSS?

Escaping output is one part of XSS defence, but you should also validate input and use your framework's own escaping.

Is my data uploaded?

No. Encoding runs in JavaScript in your browser.

All Tools