Skip to content
NMSnabbit.

HTML Encode Online

Encode reserved HTML characters like < and & into safe entities.

Encoders & Decoders Runs in your browser

What does HTML encode online do?

Five characters break HTML when written literally, and this encodes exactly those five: & becomes &amp;, < becomes &lt;, > becomes &gt;, the double quote becomes &quot; and the apostrophe becomes &#39;. Paste <b>bold</b> and you get markup that displays as text instead of rendering. Letters, digits and spaces pass through unchanged, keeping the output readable.

How to use the HTML Encode Online

  1. 1 Paste the markup or text you want displayed literally.
  2. 2 The five reserved characters convert to entities like &amp;.
  3. 3 Everything else passes through as typed.
  4. 4 Copy the entity-encoded output into your page or CMS.

What you can use it for

  • Showing example HTML tags on a web page.
  • Escaping user input before rendering it.
  • Pasting code into a blog or CMS safely.
  • Preparing snippets for documentation.

Frequently asked questions

Which characters does it convert?
Exactly five: & to &amp;, < to &lt;, > to &gt;, the straight double quote to &quot; and the apostrophe to &#39;. No others are altered.
Is this enough to stop script injection?
It covers the classic case of user text breaking out of an HTML context, but attribute, URL and JavaScript contexts have their own rules. Treat it as display escaping, not a full sanitiser.
Should accented letters become entities as well?
Not on UTF-8 pages, which is nearly all of them. Characters like é are safe to leave literal, and this tool leaves them alone for that reason.

Related tools

More Encoders & Decoders

More tools like this:

All Encoders & Decoders