🔒 100% private — runs in your browser, nothing is uploaded

HTML Entity Encoder

Encode or decode HTML entities.

HTML entities let you display reserved characters safely — essential when showing code samples or user content in web pages.

How to use

  1. Paste text or HTML.
  2. Encode turns < > & into entities; Decode reverses it.
  3. Copy the result.

About this tool

Encoding prevents the browser from interpreting your text as markup.

Everything runs locally.

How it works

In HTML, &lt; &gt; &amp; " and ' are syntax. To show them as text you write entities: &amp;lt; &amp;gt; &amp;amp; &amp;quot; &amp;#39;. The browser renders &amp;lt;div&amp;gt; as the visible text <div> instead of creating an element.

Encoding user input before inserting it into a page is the basic defense against cross-site scripting (XSS). If a comment containing <script> is stored as &amp;lt;script&amp;gt;, the browser never executes it.

Named entities (&amp;amp;) are the readable option; numeric ones (&amp;#38; or &amp;#x26;) can represent every Unicode character. Decoding reverses the process — handy when scraped pages arrive double-encoded.

Worked examples

Showing code in a blog post: To display <p>Hello</p> as text in your article, encode it to &amp;lt;p&amp;gt;Hello&amp;lt;/p&amp;gt; — otherwise the browser swallows it as a real paragraph element.

Fixing double-encoded text: Seeing &amp;amp;amp; on a page means the text was encoded twice. Decode once to get &amp;amp;, decode again to get &amp;.

Quick reference

CharacterNamed entityNumeric
&&amp;&#38;
<&lt;&#60;
>&gt;&#62;
"&quot;&#34;
'&#39;&#39;
(non-breaking space)&nbsp;&#160;

Frequently asked questions

When do I need entities?

When displaying <, > or & as text in HTML, or sanitizing user input for display.

What is &amp;amp;?

The entity for an ampersand itself — entities can be nested.

Is my input uploaded?

No.

📦 Embed this tool on your site

<iframe src="https://verystep.com/embed/htmlencode/" title="HTML Entity Encoder" width="100%" height="520" loading="lazy" style="border:0"></iframe>

Free to use. The embed shows a small "Powered by Verystep" link.

More free tools